primitives icon indicating copy to clipboard operation
primitives copied to clipboard

Allow orientation flipping of arrow key bindings for horizontally-oriented DropdownMenu navigation

Open terrymun opened this issue 1 year ago • 6 comments

Feature request

Overview

The keyboard interactions for the Dropdown Menu assumes that a dropdown menu is always rendered as a vertical list: in that sense, it does make sense that ArrowUp and ArrowDown keys are used to navigate between items.

However, what if a dropdown menu is rendered as a horizontal list? Would it be possible to "flip" the keyboard arrow key mapping so that ArrowLeft and ArrowRight will perform navigation from one item to another, while ArrowUp and ArrowDown are used to open submenus?

Who does this impact? Who is this for?

I encountered this need when using the Dropdown Menu to somehow mimic the UI/UX of Facebook reactions, where reactions are presented in a horizontal list. It feels unintuitive that up/down arrows are used to navigate between items for this use case.

Our current proof-of-concept implementation:

Screenshot 2023-03-06 at 23 14 17

The Facebook reaction popover/dropdown menu for reference:

Screenshot 2023-03-06 at 23 15 09

However, perhaps I am using Dropdown Menu for a pattern that it is not designed for?

terrymun avatar Mar 06 '23 22:03 terrymun

Hey @terrymun this is a great point! We've always considered DropdownMenu to be vertical. Whilst I think this is most definitely the default in 99% of cases, I think your case above makes sense too and we should add that capability similar to other components we have.

benoitgrelard avatar Mar 16 '23 14:03 benoitgrelard

@benoitgrelard I'd like to work on this

gitryder avatar Mar 16 '23 20:03 gitryder

I came here because I ran into the same issue with the same use-case as @terrymun. It's actually unclear to me if it is better to model the reactions menu as a Dropdown or a Select but regardless, the Dropdown and Select components I think could use the same orientation option as the Toolbar.

I think it's worth noting, the Select component docs say that the component adheres to the WAI-ARIA ListBox design pattern. In the keyboard interactions notes on that page it says:

  1. If the options in a listbox are arranged horizontally:
    1. Down Arrow performs as Right Arrow is described above, and vice versa.
    2. Up Arrow performs as Left Arrow is described above, and vice versa.

This wording is really confusing (and I think backwards). I think the intention is that a horizontal Select should use Left Arrow and Right Arrow to navigate between options.

sanbornhilland avatar Aug 18 '23 16:08 sanbornhilland

I know there's been some interest in adding this feature but so far there's been no movement on it so I decided to take a stab at it in #2394. If anyone has time for input I'd be glad to collaborate so we can hopefully get this issue addressed.

sanbornhilland avatar Sep 15 '23 18:09 sanbornhilland

We also bumped into this with the same use-case. (Thanks for making a PR @sanbornhilland! From an outsider's perspective, I don't see anything wrong with the direction you're taking and this initial implementation.)

marcbouchenoire avatar Sep 19 '23 12:09 marcbouchenoire

Just wondering if there's any way to keep this progressing? The change seems relatively minimal for the goal.

ericchernuka avatar Apr 05 '24 01:04 ericchernuka