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

feat: Table grid navigation #1893

Merged
merged 26 commits into from
Feb 16, 2024
Merged

feat: Table grid navigation #1893

merged 26 commits into from
Feb 16, 2024

Conversation

pan-kot
Copy link
Member

@pan-kot pan-kot commented Jan 17, 2024

Description

The PR integrates grid navigation (enhanced keyboard navigation) feature into the table component and makes it available through a public API.

Related links:

  • API: 5uPHAylzAuFG
  • Tech design: KtAVARsTM7ko
  • Draft guidelines: U6xBAYcsDaYu
  • Bug bash: 8QVkA8fIBunR

Depends on:

Related:

How has this been tested?

More integration tests to existing pages (inline editing, resizable columns, shift selection). Screenshot tests

Review checklist

The following items are to be evaluated by the author(s) and the reviewer(s).

Correctness

  • Changes include appropriate documentation updates.
  • Changes are backward-compatible if not indicated, see CONTRIBUTING.md.
  • Changes do not include unsupported browser features, see CONTRIBUTING.md.
  • Changes were manually tested for accessibility, see accessibility guidelines.

Security

Testing

  • Changes are covered with new/existing unit tests?
  • Changes are covered with new/existing integration tests?

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Copy link

codecov bot commented Jan 17, 2024

Codecov Report

Attention: 2 lines in your changes are missing coverage. Please review.

Comparison is base (2af7864) 94.79% compared to head (2e6e5ee) 94.78%.

Files Patch % Lines
src/table/internal.tsx 97.56% 1 Missing ⚠️
src/table/table-role/utils.ts 80.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1893      +/-   ##
==========================================
- Coverage   94.79%   94.78%   -0.02%     
==========================================
  Files         666      666              
  Lines       17972    17992      +20     
  Branches     5935     5942       +7     
==========================================
+ Hits        17037    17054      +17     
- Misses        870      873       +3     
  Partials       65       65              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@pan-kot pan-kot requested a review from jperals February 15, 2024 08:36

return (
<th
data-focus-id={`header-${String(columnId)}`}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this necessary?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The data-focus-id is used to keep focus outlines in sync between header and sticky header. Previously it was only possible to focus on sortable headers, select-all checkbox and resize handles. Now it is also possible to focus on header cells themselves when there are no other focus targets inside.

@@ -128,15 +138,15 @@ function useTableFocusNavigation<T extends { editConfig?: TableProps.EditConfig<
);

useEffect(() => {
if (!tableRoot.current) {
if (!tableRoot.current || tableRole === 'grid') {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not listen for events when tableRole === 'grid'?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The "grid" table role is only set when the keyboard navigation is active. It overtakes the table focus navigation developed for tables with inline editing. W/o this, both navigations will be active at the same time causing the cursor to jump two cells at a time in some cases.

@pan-kot pan-kot merged commit ae7711b into main Feb 16, 2024
41 checks passed
@pan-kot pan-kot deleted the table-grid-nav-integ branch February 16, 2024 13:06
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.

3 participants