-
Notifications
You must be signed in to change notification settings - Fork 843
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
[EuiDatePicker] Allow user text entry by preventing focus trap #4243
Conversation
Preview documentation changes for this PR: https://eui.elastic.co/pr_4243/ |
Preview documentation changes for this PR: https://eui.elastic.co/pr_4243/ |
Preview documentation changes for this PR: https://eui.elastic.co/pr_4243/ |
Looking into this
This is unchanged from the current behavior and different from the what happens in EuiColorPicker. I think the idea is that a user would be able to tab through the form without opening (and tabbing through) the popover if desired.
This is also unchanged from the current behavior, but I agree it should focus the input.
I can't replicate this (or I misunderstand the problem) |
I think this brings up a good candidate for discussion. Without a screen reader, there's nothing telling keyboard users to press down to open the popover. We should probably discuss and nail down this type of behavior for all inputs with dropdowns.
Try editing the input while the popover is not open, then open the popover. |
The usual solution to this is:
Next time a user lands on the control (e.g., input), it starts over at the top where the popover opens. This does have the downside of after pressing esc the only way to open the popover is to tab out and back into the control but that's not often a dealbreaker. We can explore other strategies (e.g., using a modifier to open the popover, adding a button to open the popover, etc) but starting with the usual solution might be a good immediate fix even while we discuss others. |
Also remembered that this was the reason we added the down arrow icon (like EuiSelect has) to EuiColorPicker. But I don't think everyone was in agreement that this was an ideal solution. |
Preview documentation changes for this PR: https://eui.elastic.co/pr_4243/ |
Preview documentation changes for this PR: https://eui.elastic.co/pr_4243/ |
Updated interaction per @myasonik details, with the addition of leaving in the down-arrow key as an option for opening the popover after using esc to close it. See how you like it; still open to discussing other options. |
Preview documentation changes for this PR: https://eui.elastic.co/pr_4243/ |
I like it! 🎉 |
Hmm.. It certainly happened at some point.. Maybe the date was invalid so it wouldn't update the calendar.. 🤷 I still can't seem to change the year though with keyboard navigation. |
Missed that the year dropdown was part of your original review. Looking. |
Preview documentation changes for this PR: https://eui.elastic.co/pr_4243/ |
Preview documentation changes for this PR: https://eui.elastic.co/pr_4243/ |
from #4243 (comment)
@cchaos what is your opinion? I think it makes sense to always allow "incomplete" dates, as long as they're formed enough that Moment can build a proper representation from them. |
Kicked the tires on Moment's "forgiving mode" date parsing, and I'm now less hesitant about using it. It respects the expected format well enough (e.g., won't parse Still would like to hear what @cchaos has to say. |
YES PLEASE! This will actually satisfy a lot of Kibana customers because the Super date picker is too strict. And would close this one #1715
I'm happy with that solution!!! |
I'll go ahead and enable forgiving mode.
And take a look at how this impacts EuiSuperDatePicker |
Updated EuiDatePicker, but EuiSuperDatePicker does not use the same date utils so is unaffected by the change. If we want to change EuiSuperDatePicker also, I'd rather do so in a separate PR. |
Preview documentation changes for this PR: https://eui.elastic.co/pr_4243/ |
Preview documentation changes for this PR: https://eui.elastic.co/pr_4243/ |
I'm ok with that, but I do think it would be a great improvement if we could get it done sooner than later. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes LGTM. Lots of good improvements.
Only regression I can find is enter no longer closes the popover, if the input box has focus.
Preview documentation changes for this PR: https://eui.elastic.co/pr_4243/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 LGTM!!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🦑 LGTM! Could not break the implementation
Preview documentation changes for this PR: https://eui.elastic.co/pr_4243/ |
Summary
Closes #3367 by preventing the internal focus trap used by
EuiDatePicker
from automatically setting focus on mount.New interaction matches that of
EuiColorPicker
and is as follows:I attempted to write a test for this, but
react-popper
errors on missingdocument
methods not available in jsdom.Checklist
- [ ] Check against all themes for compatibility in both light and dark modes- [ ] Checked in mobile- [ ] Checked in Chrome, Safari, Edge, and Firefox- [ ] Props have proper autodocs- [ ] Added documentation- [ ] Added or updated jest tests