Skip to content

[BUG]: No keyboard navigation support to Dock #985

@Sarthak-Bhagat2006

Description

@Sarthak-Bhagat2006

Describe the issue

Current Behaviour

The Dock component items have role="button" and tabIndex={0}, making them focusable via keyboard. However:

  • Pressing Enter or Space while a dock item is focused does not trigger its onClick handler.
  • Dock items have no accessible label — screen readers announce them only as "button" with no description of their action.

Expected Behaviour

  • Pressing Enter or Space on a focused dock item should activate its onClick handler, matching native <button> behavior.
  • Each dock item should expose an accessible name (via aria-label) derived from its label prop.

Proposed Solution

  • Add an onKeyDown handler to DockItem that triggers onClick on Enter or Space, with preventDefault() to avoid page scroll on Space.
  • Pass aria-label to DockItem derived from item.label.

Accessibility Benefits

This improves usability for:

  • Keyboard-only users
  • Screen reader users
  • Users relying on assistive technologies

Reproduction Link

No response

Steps to reproduce

  1. Open the Dock component demo.
  2. Press Tab until a dock item is focused.
  3. Press Enter or Space.
  4. Observe the onClick action does not trigger.

Validations

  • I have checked other issues to see if my issue was already reported or addressed

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions