Skip to content

fix the sort icons + focus the table + improve title/description of columns#135

Merged
severo merged 6 commits intomasterfrom
keyboard
Apr 28, 2025
Merged

fix the sort icons + focus the table + improve title/description of columns#135
severo merged 6 commits intomasterfrom
keyboard

Conversation

@severo
Copy link
Copy Markdown
Contributor

@severo severo commented Apr 25, 2025

Some preliminary improvements before #30

  • fix the sort arrows (they were reversed!!!)
  • now, only the scrollable div can be focused. It is outlined with a black outline (in all browsers). Note that it's not explicit with tabindex, but the default element focused by the browsers I tested (firefox and chromium) when entering the webpage with Tab
  • add description + update the title of the column headers, to describe the action when clicking them
Screencast.From.2025-04-25.23-00-41.mp4

severo added 4 commits April 25, 2025 12:18
and remove it from the table itself. When focused, the table can be
scrolled horizontally and vertically if needed with the arrows.

The Tab sequence only contains the scrollable element at the moment.

Before, it only contained the table (in Chrome) while it contained two
elements in Firefox (that already added the scrollable div to the
sequence).
See https://inclusive-components.design/data-tables/. We use caption +
aria-labelledby, instead of aria-label, because it can be translated.
With the current setup, the accessible name
(https://developer.mozilla.org/en-US/docs/Glossary/Accessible_name)
is given by the content of the <td> element, and the accessible
description
(https://developer.mozilla.org/en-US/docs/Glossary/Accessible_description)
is given by the aria-description attribute.
We also show the description in the title popup, to help understand the
sort behavior.
Note that the description provides information about the action when
clicking, not about the current state, which is already provided by
the icons and the aria-sort attribute.
@severo severo changed the title Keyboard fix the sort icons, focus the table and sort with the keyboard Apr 25, 2025
@severo severo changed the title fix the sort icons, focus the table and sort with the keyboard fix the sort icons + focus the table and sort with the keyboard Apr 25, 2025
it's the same as what Chrome shows by default, but now it's explicit and
cross browser
@severo severo changed the title fix the sort icons + focus the table and sort with the keyboard fix the sort icons + focus the table + improve title/description of columns Apr 25, 2025
@severo severo requested review from bleakley and platypii April 25, 2025 21:02
…ex should be interactive, and scolling is not interaction
@severo severo marked this pull request as ready for review April 28, 2025 09:52
@severo
Copy link
Copy Markdown
Contributor Author

severo commented Apr 28, 2025

In the demo:

Screencast.From.2025-04-28.11-59-13.mp4

@severo severo merged commit 7bc143b into master Apr 28, 2025
10 checks passed
@severo severo deleted the keyboard branch April 28, 2025 16:30
@platypii
Copy link
Copy Markdown
Contributor

this is nice overall.

my only nit is that the border shifts the content. not sure if theres a better way? Chatgpt suggested inset box-shadow:

  .table-scroll:focus {
    box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.7);
  }

@severo
Copy link
Copy Markdown
Contributor Author

severo commented Apr 28, 2025

Yes, good idea. I agree it would be better. I'll update it

Hmmm, I remember now why I didn't do that (or outline, which is even better): because the absolutely positioned table is above the outline or shadow of the parent scroll div. I'll try to find a better solution anyway.

@severo
Copy link
Copy Markdown
Contributor Author

severo commented Apr 29, 2025

With keyboard navigation (#30), maybe we don't need to focus the whole table anyway. Let's see how to handle this in the next PRs.

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