Skip to content

a11y: Can't tab into DropdownTrigger #44

@rakeshpai

Description

@rakeshpai

Since the dropdown trigger is a link without an href, most browsers don't make it focusable, thus it's not possible to tab to the dropdown with a keyboard. This makes the dropdown trigger and all its contents inaccessible to keyboard users.

I found that a previous issue (#29) removed the href attribute, which makes sense in that context.

I could take a stab at a PR, if we agree that this needs to go back in. However, we'll need to decide what a href value should be.

Personally, I don't like using either '#' or 'javascript:void(0)', because the former requires a event.preventDefault() so as not to mess up browser history, and the latter is basically inline JS being eval'd, which makes it incompatible with CSP. In such situations (link that's only used for interaction, not navigation), I usually prefer to use a <button> element instead. Not sure what you'd think about changing the trigger to a button though.

If you don't want to change to a button element, we can stick to a href of '#' with a .preventDefault() on the link.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions