Skip to content

a11y scroll issue with the tabs on space-key #1563

@rnacken

Description

@rnacken

Describe the bug

The tabs can be selected with arrow-keys and enter of space. When you use space however, the default browser behaviour to scroll down (like a page down) is also executed, scrolling away from the tabs.

How to reproduce

  1. Go to https://hds.hel.fi/components/tabs/code/
  2. tab to a tab-component
  3. Use arrow-key to move to a different tab and press space to select it
  4. Note that using enter shows the expected behaviour

Expected behavior

The browser should not scroll down when using space

Possible solution

Prevent the default behaviour with using event.preventDefault() on the click-handler of the space key in the component

Device information

Desktop (please complete the following information):

  • OS: MacOSX Sequoia 15.1
  • Browser: Chrome
  • Version: latest (142.0.7444.60)

Smartphone (please complete the following information):
Not relevant (no keyboard)

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions