Skip to content

[mediaqueries-5] detect keyboard navigation abilities #1911

@frivoal

Description

@frivoal

If @media (pointer) (or @media (any-pointer)) evaluates to false, presumably the user is using some sort of keyboard input or similar, and pressing tab (or similar) to navigate the focusable elements in the page. Complex layouts are tedious to navigate this way, so in such situations, authors may want to switch to a simpler, linear design.

However, even if there's no pointer, if the user does have a device that is capable of spatial navigation (as discussed in https://drafts.csswg.org/css-ui-4/#nav-dir or https://github.com/lgeweb/spatial-navigation), then using a complex layout may be fine.

There's currently no media feature enabling authors to detect that.

Proposal for a new media feature:

nav: none | sequential | spatial (or key-navigation instead of nav if we want to be verbose)

@media (nav: sequential) is true if the user has a tab key or equivalent mechanism
@media (nav: spatial) is true if the user can navigate with arrow keys

Both can be true at the same time if the device matches.

cc @tabatkins @jihyerish

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions