You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Grid Pro checkboxes can't be clicked on Safari #6756
Looks like there is a focusout event fired on mousedown when attempting to click vaadin-checkbox in Safari.
This does not happen in Chrome and Firefox. We might want to use event.preventDefault() as a workaround.
// Clicking the checkbox or radio-button in Safari
// does not make it focused, so we do it manually.
if(!isElementFocused(input)){
input.focus();
}
It's apparently no longer enough. It successfully sets focus when you click on a checkbox that doesn't have focus yet. But, when you click on a checkbox that already has focus, what happens is that Safari first removes focus – which results in a focusout – and then the workaround returns focus back on the checkbox. However, that focusout becomes enough for grid-pro to close the editor.
It seems adding a [tabindex=0] to the input element fixes the issue. Note, the version 14 also sets this attribute by default. Also, it makes the above workaround unnecessary.
Activity
web-padawan commentedon Nov 7, 2023
Looks like there is a
focusoutevent fired onmousedownwhen attempting to clickvaadin-checkboxin Safari.This does not happen in Chrome and Firefox. We might want to use
event.preventDefault()as a workaround.vursen commentedon Nov 8, 2023
Just for the record, the checkbox works fine on my iPhone (iOS 17.0.3).
vursen commentedon Nov 9, 2023
The issue can be observed with the pure checkbox component:
focusouton the second click in Safari, but nofocusoutin Chrome.At the same time, it's not reproducible with the native checkbox, which makes me suspect it has to do with CSS or Shadow DOM.
DiegoCardoso commentedon Nov 10, 2023
Just to mention that the same Grid Pro example in V14 works in Safari
vursen commentedon Nov 13, 2023
I just noticed that there is a workaround in
checkboxwhich has been specifically introduced to make focus work in Safari:web-components/packages/field-base/src/checked-mixin.js
Lines 52 to 56 in ab1f77a
It's apparently no longer enough. It successfully sets focus when you click on a checkbox that doesn't have focus yet. But, when you click on a checkbox that already has focus, what happens is that Safari first removes focus – which results in a
focusout– and then the workaround returns focus back on the checkbox. However, thatfocusoutbecomes enough forgrid-proto close the editor.vursen commentedon Nov 13, 2023
It seems adding a
[tabindex=0]to the input element fixes the issue. Note, the version 14 also sets this attribute by default. Also, it makes the above workaround unnecessary.