Skip to content

Commit

Permalink
fix(QSelect): "option" slot has incorrect "selected" param value when…
Browse files Browse the repository at this point in the history
… the option is disabled #16567
  • Loading branch information
rstoenescu committed Nov 29, 2023
1 parent bfb62f0 commit 2e7e756
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions ui/src/components/select/QSelect.js
Original file line number Diff line number Diff line change
Expand Up @@ -319,11 +319,12 @@ export default createComponent({

return props.options.slice(from, to).map((opt, i) => {
const disable = isOptionDisabled.value(opt) === true
const active = isOptionSelected(opt) === true
const index = from + i

const itemProps = {
clickable: true,
active: false,
active,
activeClass: computedOptionsSelectedClass.value,
manualFocus: true,
focused: false,
Expand All @@ -332,16 +333,14 @@ export default createComponent({
dense: props.optionsDense,
dark: isOptionsDark.value,
role: 'option',
'aria-selected': active === true ? 'true' : 'false',
id: `${ state.targetUid.value }_${ index }`,
onClick: () => { toggleOption(opt) }
}

if (disable !== true) {
isOptionSelected(opt) === true && (itemProps.active = true)
optionIndex.value === index && (itemProps.focused = true)

itemProps[ 'aria-selected' ] = itemProps.active === true ? 'true' : 'false'

if ($q.platform.is.desktop === true) {
itemProps.onMousemove = () => { menu.value === true && setOptionIndex(index) }
}
Expand Down

0 comments on commit 2e7e756

Please sign in to comment.