Add onOpen, onClose and onTouch callbacks
#1731
JesusTheHun
started this conversation in
Ideas
Replies: 1 comment 1 reply
-
|
I'd like to add another use case for a Combobox onOpen event. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
When using a combobox in a form, there is a concept of
touchedfields : if a field is required to not be empty for example, we don't want to show an error message right away when the form loads, it wouldn't make any sense, but once he touches the field (focus the input) and leave the focus with an invalid value (empty input), the field is considered "touched" and therefore, now, we want to show the error message.Right now we have to use workarounds to make this work, and mark the field as touched :
Combobox:onBlurof theinputListbox:onBlurof theoptionsSwitch:onChangeof theswitchRadioGroup: not possible.onChangeis only triggered when the value actually changes, so if the user clicks on the selected option, it doesn't work. UsingonClickon any element below theRadioGroupelement doesn't work, I assume you stopped the propagation of theclickevent during the capture phase.Using those hackround to make this work is pretty annoying and requires research on how the
headlessuicomponents actually work in term of focus management, to get it right. I'm not even sure I got it right yet.onTouchhas a strong semantic but is applicable to all components.onOpen&onCloseare more general purpose callbacks so they could be used for thetouchedstate, but they are not applicable in the case of aSwitchor aRadioGroup.How do you feel about this ?
Beta Was this translation helpful? Give feedback.
All reactions