When using Dropdown and Combo Box in forms, it's common to set validation during onBlur event to check whether the field is left blank but required, i.e., passing onBlur event to form controls. In current implementation, mouse down event on the list control options would trigger onBlur, resulted a false negative user feedback.
See below example when using them with react-hook-form
Area
UI Components
The problem
When using Dropdown and Combo Box in forms, it's common to set validation during
onBlur
event to check whether the field is left blank but required, i.e., passingonBlur
event to form controls. In current implementation, mouse down event on the list control options would triggeronBlur
, resulted a false negative user feedback.See below example when using them with
react-hook-form
https://stackblitz.com/edit/salt-template-h2lymn?file=App.tsx,package.json
The solution
Do not trigger blur event on the main form control when selecting options using mouse.
Alternatives and examples
Above behavior also made it hard to implement custom ag grid editors, when
stopEditingWhenCellsLoseFocus
is set to true. Possible workaround: add additional classnameag-custom-component-popup
to the popup element. Demo: https://stackblitz.com/edit/salt-ag-grid-theme-t9gyex?file=App.jsxAre you a JPMorgan Chase & Co. employee?