Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions packages/main/cypress/specs/Input.cy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2270,6 +2270,18 @@ describe("Input general interaction", () => {
cy.get("@onInput").should("have.been.calledTwice");
});

it("Clear icon is exposed as a button with an accessible name", () => {
cy.mount(
<Input id="clear-input" showClearIcon={true} value="test" />
);

cy.get("#clear-input")
.shadow()
.find(".ui5-input-clear-icon-wrapper")
.should("have.attr", "role", "button")
.and("have.attr", "aria-label", "Clear");
});

it("Change event is called when value of input is cleared with clear icon and input is focused out", () => {
const onChange = cy.spy().as("onChange");
const onInput = cy.spy().as("onInput");
Expand Down
2 changes: 2 additions & 0 deletions packages/main/src/InputTemplate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ export default function InputTemplate(this: Input, hooks?: { preContent: Templat
{this._effectiveShowClearIcon &&
<div
tabindex={-1}
role="button"
aria-label={this.clearIconAccessibleName}
class="ui5-input-clear-icon-wrapper inputIcon"
part="clear-icon-wrapper"
onClick={this._clear}
Expand Down