Skip to content

clear icon keyboard accessibility #602

Description

@TkDodo

The clearIcon can be any React.ReactNode, so I tried to make it a <button> with an icon to make it keyboard accessible. This generally works fine - navigating with TAB puts the focus on that icon. However, trying to press that button then either via ENTER the SPACE key does not trigger a clear event.

The tests seems to use mousedown:

wrapper
.find('.rc-select-clear')
.last()
.simulate('mousedown');

Is there a way to make clearing the value keyboard accessible?

Activity

  1. dvberzon commented on Jun 16, 2025

    @dvberzon

    This is a serious accessibility issue. Currently for a single select there is no way for a keyboard user to clear the selection (reopening the dropdown and trying to unselect the selected option will not work either). The component needs to support keyboard focus on the clear icon, or support onKeyDown if the user supplied allowClear icon has a keydown event

  2. nrps9909 commented on Aug 26, 2026

    @nrps9909
    Contributor

    This has been fixed by #1224. The clear control is now a native <button type="button"> with an accessible label, and the shared allow-clear suite covers native Enter/Space activation. I verified the change is present on current master at a0bd83e.

  3. yoyo837 commented on Aug 27, 2026

    @yoyo837
    Member

    Close by #1224

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions