Skip to content

Commit

Permalink
fix(VList): only set aria-selected on selectable items
Browse files Browse the repository at this point in the history
fixes #20666
closes #20708
  • Loading branch information
KaelWD committed Nov 20, 2024
1 parent fd844e1 commit 72df0b4
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions packages/vuetify/src/components/VList/VListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,11 @@ export const VListItem = genericComponent<VListItemSlots>()({
(props.active || link.isActive?.value || (root.activatable.value ? isActivated.value : isSelected.value))
)
const isLink = computed(() => props.link !== false && link.isLink.value)
const isSelectable = computed(() => (!!list && (root.selectable.value || root.activatable.value || props.value != null)))
const isClickable = computed(() =>
!props.disabled &&
props.link !== false &&
(props.link || link.isClickable.value || (!!list && (root.selectable.value || root.activatable.value || props.value != null)))
(props.link || link.isClickable.value || isSelectable.value)
)

const roundedProps = computed(() => props.rounded || props.nav)
Expand Down Expand Up @@ -244,7 +245,13 @@ export const VListItem = genericComponent<VListItemSlots>()({
props.style,
]}
tabindex={ isClickable.value ? (list ? -2 : 0) : undefined }
aria-selected={ root.activatable.value ? isActivated.value : isSelected.value }
aria-selected={
isSelectable.value ? (
root.activatable.value ? isActivated.value
: root.selectable.value ? isSelected.value
: isActive.value
) : undefined
}
onClick={ onClick }
onKeydown={ isClickable.value && !isLink.value && onKeyDown }
v-ripple={ isClickable.value && props.ripple }
Expand Down

0 comments on commit 72df0b4

Please sign in to comment.