sourcegraph / sourcegraph-public-snapshot

Code AI platform with Code Search & Cody
https://sourcegraph.com
Other
10.1k stars 1.27k forks source link

[Accessibility]: Global `<Menu>`: Focus isn't moved to first item when menu is opened #36350

Open umpox opened 2 years ago

umpox commented 2 years ago

Audit type

Keyboard navigation

User journey audit issue

No response

Problem description

We're having issues when opening menus where it isn't obvious where the focus is, and requires additional steps to select certain items.

For example, see how it isn't immediately obvious in our Menu component from Storybook: InaccessibleMenu

Expected behavior

When opening a menu with a keyboard, the first item should always be focused.

See this example: https://w3c.github.io/aria-practices/examples/menu-button/menu-button-links.html AccessibleMenu

Additional details

Related issues:

Assigning labels

Owner

This issue will be fixed by GitStart. I have assigned the label 'gitstart' and added the assignee 'gitstart-sourcegraph'.

gitstart-app[bot] commented 2 years ago

Here is the GitStart Ticket for this issue: https://app.gitstart.com/clients/sourcegraph/tickets/SG-36350

umpox commented 2 years ago

Re-opening this.

We have had to revert due to performance issues when using this change with our rendering logic (https://github.com/sourcegraph/sourcegraph/pull/38298)

Will keep this open and aim to address this problem further.

@gitstart-sourcegraph No need for any immediate action, we'll investigate this further first

felixfbecker commented 1 year ago

Relevant spec:

When a menu opens, keyboard focus is placed on the first menu item. To be keyboard accessible, you need to manage focus for all descendants: all menu items within the menu are focusable. The menu button which opens the menu and the menu items, rather than the menu itself, are the focusable elements.