-
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
Overhaul EuiDataGrid's cell focus states #3128
Overhaul EuiDataGrid's cell focus states #3128
Conversation
Preview documentation changes for this PR: https://eui.elastic.co/pr_3128/ |
When tabbing into the grid for the first time, focus skips all the toolbar items. Full steps
The bugTabbing from "demo html" goes directly to the first cell instead of the first toolbar item Note: Only tested in Firefox |
OK, I've got a very odd bug... Full steps
THE BUGAfter the last toolbar control but before the first cell, notice an extra tab stop where focus is seems to be set on the whole grid Note: Only tested in Firefox |
A feature request for the test page (which I otherwise love!) — a toggle on the page to make the columns interactive |
Fixed, was targeting the wrong div
FireFox allows tabbing to a scrollable element. I've added an explicit
Not sure I know exactly what you mean; I take this to mean having 3 columns with no interactive elements and the toggle show/hides interactive elements into those? |
Preview documentation changes for this PR: https://eui.elastic.co/pr_3128/ |
Confirmed that I can't recreate those bugs anymore! 🎉 Don't know if this is something you want to handle here or as part of another ticket (as it's not introduced as part of this PR): We should scroll the container to completely show the currently focused cell. |
I noticed this when testing in FF yesterday (Chrome works as expected). Let's deal with that in another issue. Mind creating it? |
Pushed a toggle to enable/disable interactive headers in the focus example, which caught another focus bug. |
Preview documentation changes for this PR: https://eui.elastic.co/pr_3128/ |
Not 100% sure what the interaction here should be so just bringing this up for discussion Steps
Bug?Focus is set on the cell, not on the content as it is when arrowing around in the grid. (You can also recreate this effect by clicking in the cell but not on the interactive item itself.) |
Advanced keyboard control bugs
|
I'm doing a cleanup pass on the docs for this as part of my review. Functionally it seems to make sense. Issues that I see in it such as how to tab through truncated items I think are solvable by judicious use of other bits of functionality in Data Grid such as set widths, expandable cells...etc. |
Preview documentation changes for this PR: https://eui.elastic.co/pr_3128/ |
Sorry, the commit reminded me I still have a todo here. I'll try and get it done this week. I didn't see any major issues functionally. If @myasonik is OK with the state of this PR, I can always PR after since my changes were just to docs. |
Preview documentation changes for this PR: https://eui.elastic.co/pr_3128/ |
@myasonik all 3 bugs are now fixed! |
Preview documentation changes for this PR: https://eui.elastic.co/pr_3128/ |
After iterating with @myasonik , page up & page down will now always shift focus to the bottom or top (respectively) of the page, not only when actually paging. Also added pagination to the focus example for easier testing. |
Preview documentation changes for this PR: https://eui.elastic.co/pr_3128/ |
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.
After playing around with it, I think this is better than what we had for sure.
I wonder if I might still expect that if you're on the first/last page that page up/down would bring you to the top/bottom of the grid. (Technically becoming not-like the rest but my brain keeps thinking that's how it should work.)
Either way, it's all up to interpretation and feelings now so I'm good to ship. We can open up a followup ticket if we want to discuss it or wait and see if anyone else opens up issues.
🚀
Let me know when this is ready, @chandlerprall |
@thompsongl this now looks stable for review, thanks! |
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.
Code LGTM. I also (successfully) ran through the scenarios in the docs for good measure
@@ -57,6 +57,13 @@ export class EuiFocusTrap extends Component<Props, State> { | |||
this.setInitialFocus(this.props.initialFocus); | |||
} | |||
|
|||
componentDidUpdate(prevProps: Props) { | |||
if (prevProps.disabled === true && this.props.disabled === false) { | |||
// eslint-disable-next-line react/no-did-update-set-state |
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.
Wondering if we should open an issue to convert this to a function component. Avoiding this is probably worth it.
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.
TBH I've never cared about this react lint rule. We should convert for the sake of converting, at some point. though. Helps avoid these types of bugs
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.
Will merge on green CI. Thanks everyone! |
Preview documentation changes for this PR: https://eui.elastic.co/pr_3128/ |
Summary
Fixes #2626
This is ready to review functionality, not yet the code side.
Added a new docs page for data grid, Data grid focus, to track requirements and provide a datagrid for testing these states. This also touched
EuiFocusTrap
's outside-click-disabling, so we'll want to double check that (added ability to re-enable a trap which was previously-disabled-by-click).I also want to diagram/record the focus logic and refactor it, but that has to wait until the logic is solidified and should be in another PR.
Checklist
- [ ] Check against all themes for compatibility in both light and dark modes- [ ] Props have proper autodocs- [ ] Added documentation examples