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

#562: Add accessible reorder option in column menu [new] #984

Merged
merged 4 commits into from
Nov 28, 2022

Conversation

iamanishroy
Copy link
Member

@iamanishroy iamanishroy commented Nov 25, 2022

#562: Add accessible reorder option in column menu.

Worked on this improvement.

I have used react-beautiful-dnd as recommended.

  • Ordering feature will be disabled when the search filter is applied.
  • No changes on the appearance of button.

image

Linked to PR #983 -> created because of some issue with branch.

@vercel
Copy link

vercel bot commented Nov 25, 2022

@iamanishroy is attempting to deploy a commit to the Rowy Team on Vercel.

A member of the Team first needs to authorize it.

@vercel
Copy link

vercel bot commented Nov 25, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
rowy-os ✅ Ready (Inspect) Visit Preview Nov 25, 2022 at 4:00PM (UTC)

Copy link
Contributor

@notsidney notsidney left a comment

Choose a reason for hiding this comment

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

Thanks @iamanishroy, this looks good to me. It looks like you had to read the docs of https://github.com/rowyio/multiselect to implement this as well, so thanks for being diligent.

A note on extending this menu in the future

This was built with the MultiSelect component, which was designed specifically for multiple selection. Adding more functionality like this would be better served by not using MultiSelect for this anymore.

There are two “hacks” that have been needed to implement this feature:

  1. Create a new dragDisabled state to track if the user has input anything in the search box. This is done by tracking the onInput event. This should be derived from the state of that input’s value, but this is intentionally not accessible in the MultiSelect component.
  2. There are two paths to access items with the keyboard. When the input is focused, the user can press the arrow keys to select columns to be hidden. This is consistent with the WAI-ARIA guidelines implemented by the MUI Autocomplete component, on which this component is based.
    But to reorder columns, the user must press Tab to select each individual column. This also makes the “Clear” and “Done” buttons less accessible, as previously they only had to Tab once to get to them, but must now go through all columns.

src/components/TableToolbar/HiddenFields.tsx Outdated Show resolved Hide resolved
@notsidney notsidney merged commit 1ac3afd into rowyio:develop Nov 28, 2022
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.

2 participants