Skip to content
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

[EuiFieldNumber] Update native validity state on blur & report/surface native validation messages #6758

Closed
wants to merge 2 commits into from

Conversation

cee-chen
Copy link
Member

@cee-chen cee-chen commented May 8, 2023

Summary

closes #6747

As @dej611 noted in the linked issue, several browsers (namely Safari) do a really poor job of surfacing their native validity messages, meaning that we're rendering inputs as invalid/with a scary warning icon without actually telling users why.

The native browser way of handling this would be to use the reportValidity API, which renders minimally intrusive browser tooltips with the native error messages, without requiring a hover action from users.

If consumers would prefer to render their own error messages via <EuiFormRow error={}>, they can do so and turn off the browser-level invalid reports via reportNativeInvalidity={false}.

Chrome/Edge:

edge

Firefox:

firefox

Safari

(Safari's validation is still kinda garbage but a bit better than before)
safari

QA

General checklist

  • Checked in both light and dark modes (native browser reporting follows system darkmode, not EUI darkmode)
  • Checked in Chrome, Safari, Edge, and Firefox
  • Props have proper autodocs (using @default if default values are missing) and playground toggles
  • Added documentation
  • Added or updated jest and cypress tests
  • Checked for accessibility including keyboard-only and screenreader modes
  • A changelog entry exists and is marked appropriately

…se validation messages via `title`

- primarily Safari
- so that reported tooltips don't disappear immediately on outside click
@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_6758/

@cee-chen
Copy link
Member Author

cee-chen commented May 8, 2023

Putting a stop to this - in my SR/keyboard testing I unfortunately discovered webkit browsers autofocus inputs when reportValidity is called, meaning that invoking the validity check/report onBlur causes focus to be trapped on the input 💀

@cee-chen cee-chen closed this May 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[EuiNumberField] Invalid step tooltip does not always show up for invalid values
2 participants