Skip to content

Commit

Permalink
fix(QChip): use sepparate attrs for chip and remove button quasarfram…
Browse files Browse the repository at this point in the history
  • Loading branch information
pdanpdan committed Oct 5, 2022
1 parent 952e7d8 commit 65f471b
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions ui/src/components/chip/QChip.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,16 +102,19 @@ export default createComponent({
+ (isDark.value === true ? ' q-chip--dark q-dark' : '')
})

const attributes = computed(() => (
props.disable === true
const attributes = computed(() => {
const chip = props.disable === true
? { tabindex: -1, 'aria-disabled': 'true' }
: {
tabindex: props.tabindex || 0,
role: 'button',
'aria-hidden': 'false',
'aria-label': props.removeAriaLabel || $q.lang.label.remove
}
))
: { tabindex: props.tabindex || 0 }
const remove = {
...chip,
role: 'button',
'aria-hidden': 'false',
'aria-label': props.removeAriaLabel || $q.lang.label.remove
}

return { chip, remove }
})

function onKeyup (e) {
e.keyCode === 13 /* ENTER */ && onClick(e)
Expand Down Expand Up @@ -169,7 +172,7 @@ export default createComponent({
h(QIcon, {
class: 'q-chip__icon q-chip__icon--remove cursor-pointer',
name: removeIcon.value,
...attributes.value,
...attributes.value.remove,
onClick: onRemove,
onKeyup: onRemove
})
Expand All @@ -188,7 +191,7 @@ export default createComponent({

isClickable.value === true && Object.assign(
data,
attributes.value,
attributes.value.chip,
{ onClick, onKeyup }
)

Expand Down

0 comments on commit 65f471b

Please sign in to comment.