Skip to content

Commit

Permalink
fix(ui): QList role computed prop -> lint issue & never return undefi…
Browse files Browse the repository at this point in the history
…ned (fix: #17439) (#17441)
  • Loading branch information
rstoenescu committed Sep 3, 2024
1 parent d88db9d commit 2120fe8
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions ui/src/components/item/QList.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import { createComponent } from '../../utils/private.create/create.js'
import useDark, { useDarkProps } from '../../composables/private.use-dark/use-dark.js'
import { hSlot } from '../../utils/private.render/render.js'

const roleAttrExceptions = [ 'ul', 'ol' ]

export default createComponent({
name: 'QList',

Expand All @@ -25,6 +27,10 @@ export default createComponent({
const vm = getCurrentInstance()
const isDark = useDark(props, vm.proxy.$q)

const role = computed(() => (
roleAttrExceptions.includes(props.tag) ? null : 'list')
)

const classes = computed(() =>
'q-list'
+ (props.bordered === true ? ' q-list--bordered' : '')
Expand All @@ -34,8 +40,6 @@ export default createComponent({
+ (props.padding === true ? ' q-list--padding' : '')
)

const role = computed(() => props.tag === 'ul' || props.tag === 'ol' ? undefined : 'list')

return () => h(props.tag, { class: classes.value, role: role.value }, hSlot(slots.default))
}
})

0 comments on commit 2120fe8

Please sign in to comment.