Skip to content

fix(ui5-input): expose clear icon as a button with an accessible name - #14281

Open
devteamaegis wants to merge 1 commit into
UI5:mainfrom
devteamaegis:fix/input-clear-icon-accessible-name
Open

devteamaegis wants to merge 1 commit into
UI5:mainfrom
devteamaegis:fix/input-clear-icon-accessible-name

Conversation

@devteamaegis

Copy link
Copy Markdown

Fixes #14265

Problem

With showClearIcon set, the clear icon in ui5-input has no accessible name. The wrapper div that handles the click has no role or label. The inner ui5-icon does get accessibleName="Clear", but it renders in its default Decorative mode. In that mode the icon's root gets aria-hidden="true" and role="presentation", so the name never reaches assistive technology.

Change

  • InputTemplate.tsx: add role="button" and aria-label={this.clearIconAccessibleName} to .ui5-input-clear-icon-wrapper. This reuses the existing INPUT_CLEAR_ICON_ACC_NAME ("Clear") text, so no new i18n keys are needed. That matches the two spec points quoted in the issue: role=button on inner button-like icons, and an aria-label for icon-only buttons.
  • Focus behaviour does not change. The wrapper keeps tabindex="-1", so the clear icon stays out of the tab order as it is today.
  • Input.cy.tsx: new test that checks the wrapper has role="button" and aria-label="Clear".

I set the role on the wrapper rather than switching the icon to mode="Interactive". Interactive mode would put tabindex="0" and key handlers on the inner SVG, which would change focus behaviour.

ui5-combobox, ui5-multi-combobox and the AI ui5-input use the same clear-icon markup and have the same gap. I kept this PR to the component in the issue. I can extend it to those if you'd like.

Testing

  • yarn ts passes, packages/main yarn lint passes, and the compiled dist/InputTemplate.js contains the new attributes.
  • I did not run the new Cypress test locally. CI will run it.

This was investigated and written with an AI coding agent (Claude) working on my behalf.

The clear icon wrapper had no role or label, and the inner ui5-icon is
rendered in its default Decorative mode, which sets aria-hidden="true".
The existing "Clear" accessible name on the icon was therefore never
exposed, so assistive technologies saw an unlabelled clickable element.

Add role="button" and aria-label to the clear icon wrapper, reusing the
existing INPUT_CLEAR_ICON_ACC_NAME text. Focus behaviour is unchanged
(the wrapper stays tabindex="-1").

Fixes UI5#14265

Signed-off-by: devteamaegis <devteam.aegis@gmail.com>
@cla-assistant

cla-assistant Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[ui5-input] Clear button inside input has no accessible text when showClearIcon is enabled

1 participant