Skip to content

Commit

Permalink
fix(QField): unexpected data clearing with "clearable" prop enabled #…
Browse files Browse the repository at this point in the history
  • Loading branch information
rstoenescu committed May 8, 2024
1 parent 41bc5e7 commit 899d55a
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions ui/src/composables/private.use-field/use-field.js
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,10 @@ export default function (state) {
})
}

function onClearableKeyup (evt) {
[ 13, 32 ].includes(evt.keyCode) && clearValue(evt)
}

function getContent () {
const node = []

Expand Down Expand Up @@ -390,12 +394,11 @@ export default function (state) {
getInnerAppendNode('inner-clearable-append', [
h(QIcon, {
class: 'q-field__focusable-action',
tag: 'button',
name: props.clearIcon || $q.iconSet.field.clear,
tabindex: 0,
type: 'button',
'aria-hidden': null,
role: null,
role: 'button',
'aria-label': $q.lang.label.clear,
onKeyup: onClearableKeyup,
onClick: clearValue
})
])
Expand Down

0 comments on commit 899d55a

Please sign in to comment.