-
Notifications
You must be signed in to change notification settings - Fork 841
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[EuiNumberField] Invalid step tooltip does not always show up for invalid values #6747
Comments
@dej611 What version of EUI is this? |
I've tested on latest deployed on the EUI website and on Kibana here: elastic/kibana#155208 |
It looks like the browser behavior is a bit inconsistent here between Safari, Chrome, and Firefox. I created a simple CodeSandbox demo. In Safari, when the In Chrome, with the same invalid input, I can only see the warning message on the tooltip sometimes. It does not reappear when removing focus from the input and selecting it again. In Firefox, I can see the warning message once. Just like Chrome, it does not reappear if I lost focus on the input and focus again. |
In general, EUI should not be in the business of fixing browsers and browser-level APIs. It's incredibly unlikely that we'll bake anything by default into Example CodeSandbox: https://codesandbox.io/s/hungry-cerf-m14fpn?file=/demo.js In general, the absolute best validation is to perform your own and pass your own |
From a quick check another alternative I found was to explicitly call the const onChange = (e) => {
setValue(e.target.value);
if(!e.target.checkValidity()){
e.target.reportValidity();
}
}; the result is a bit invasive but at least is cross-browser consistent. |
Super interesting and awesome use of the validity API! On a separate note, that's interesting that @dej611, are you thinking we could/should bake |
As a component consumer I would like this as well. |
@dej611 I spiked this out a bit, but incredibly unfortunately, all webkit browsers (Safari/Chrome/FF) have a side effect where To be perfectly honest with you, I'm incredibly leery of continuing further down this road (trying to polyfill/fix/smooth over default browser behavior). I think the biggest problem that started this whole mess is that we conflated consumer eui/src/global_styling/mixins/_form.scss Lines 227 to 229 in 0d31625
TBH, my 2c is that we either should have baked in showing default browser error messages from the get-go (which would require extra context and wiring between BTW, I really appreciate this report still as it helped me debug/drill down into why |
Closing this issue in favor of #6802. If we lean further into surfacing browser validity messages, we'll want to do so holistically (across all validatable form components, not just EuiFieldNumber), and we'll also likely want to integrate those messages into |
Describe the bug
When using a
<EuiNumberField step={1} .../>
I would expect the native helping tooltip to show up together with the warning sign (on hover), but it doesn't work all the times.In Safari it does not work at all.
In Chrome I've found that it works intermittently depending on the amount of props passed to the component.
In Firefox it works ok in all cases I've tested in Lens.
The text was updated successfully, but these errors were encountered: