Skip to content

fix(a11y): hide clear button on required select and array widgets#8315

Open
Wagner3UB wants to merge 5 commits into
mainfrom
fix/a11y-select-clear-required
Open

fix(a11y): hide clear button on required select and array widgets#8315
Wagner3UB wants to merge 5 commits into
mainfrom
fix/a11y-select-clear-required

Conversation

@Wagner3UB
Copy link
Copy Markdown
Contributor

@Wagner3UB Wagner3UB commented Jun 4, 2026

Partially fixes #5140

What

Improves keyboard accessibility for the clear button and hides it on required fields in SelectWidget and ArrayWidget.

Changes

  • SelectWidget / ArrayWidget: isClearable now respects the required prop — the clear button is hidden on required fields.
  • SelectStylingClearIndicator: overrides react-select's default aria-hidden="true" on the clear button, adding role="button", tabIndex=0, and an onKeyDown handler so the button is reachable via Tab and activatable with Enter or Space.

Behavior after fix

  • Required fields no longer show the clear button (e.g. "Portal default timezone", "First weekday" in the Date and Time control panel).
  • Non-required fields: the clear button is now reachable via Tab and can be activated with Enter or Space.

@Wagner3UB Wagner3UB requested review from a team and stevepiercy June 5, 2026 06:04
@Wagner3UB Wagner3UB self-assigned this Jun 5, 2026
@Wagner3UB Wagner3UB marked this pull request as ready for review June 5, 2026 06:04
@github-project-automation github-project-automation Bot moved this to In progress in Accessibility Jun 5, 2026
Copy link
Copy Markdown
Collaborator

@stevepiercy stevepiercy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A minor tweak and a question.

@@ -0,0 +1 @@
Hide the clear button in `SelectWidget` and `ArrayWidget` when the field is marked as required, and make it keyboard accessible (Tab, Enter, Space) on non-required fields. @Wagner3UB
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A sprinkling of MyST fair dust.

Suggested change
Hide the clear button in `SelectWidget` and `ArrayWidget` when the field is marked as required, and make it keyboard accessible (Tab, Enter, Space) on non-required fields. @Wagner3UB
Hide the clear button in `SelectWidget` and `ArrayWidget` when the field is marked as required, and make it keyboard accessible ({kbd}`Tab`, {kbd}`Enter`, {kbd}`Space`) on non-required fields. @Wagner3UB

...props.innerProps,
'aria-hidden': false,
role: 'button',
tabIndex: 0,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to verify the desired behavior, if there are multiple controls each with a clear indicator of tabindex=0, then first the controls would be tab-able in the order they appear, followed by the clear buttons in the order they appear.

If it were me, instead I'd like to have the clear button tab-able immediately after its control.

@github-project-automation github-project-automation Bot moved this from In progress to Review in progress in RedTurtle priorities Jun 5, 2026
@github-project-automation github-project-automation Bot moved this from In progress to Review in progress in Accessibility Jun 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Review in progress
Status: Review in progress

Development

Successfully merging this pull request may close these issues.

a11y - site setup - Date and Time - cancel/delete buttons input fields - cms ui

2 participants