Skip to content

[select] Specifying direction for arrow key navigation #1229

Open
@una

Description

@una

Proposal

the ability to set directionality for the arrow key/tab navigation of select options:

Syntax is very strawman, but I wold like the ability to decide if the direction should be block, inline, or both.

::picker(select) {
  tab-direction: block || inline || block inline || both; /* alternatively both = block inline */
  tab-start: start || end;
}

"tab-direction"

  • tab-direction: block = also the default (current behavior), arrow keys up and down move through options in one direction
  • tab-direction: inline = arrow keys left and right move through options in one direction
  • tab-direction: block inline = left arrow behavior, and bottom arrow = right arrow behavior move through options in one direction
  • tab-direction: both = arrow keys up/left/down/right move in multiple directions (I'm not sure how this would be implemented to be honest, but it would be neat!)

** horizontal and vertical may be better than inline and block*

"tab-start"

  • tab-start: start = navigation starts at first item (current default)
  • tab-start: end = navigation starts at last item, and moves to first

Examples

Demo 1: AirBnb select demo

Image

This one would benefit from tab-direction: both

Demo 2: Rotated cards (Canary only, uses size attribute, will probably break)

Image

Here is a select with options that are accessed via scroller. The intersection of select (arrow keys up and down) and horizontal scroll (arrow keys left and right) don't play well together.

In this example, I can visually move through the list, snapping the items into place using the left and right arrow keys. I can tab through the items using the up and down arrows, but visually the items don't snap into place.

Demo 3: Radial menu

Image

This menu should go right to left horizontally:

tab-direction: inline;
tab-start: end;

Prior art

I hoped reading-flow() would help here but it doesn't seem to.

Metadata

Metadata

Assignees

No one assigned

    Labels

    selectThese are issues that relate to the select component

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions