Skip to content

Commit

Permalink
fix(ui5-rating-indicator): allow tab next/prev when readonly
Browse files Browse the repository at this point in the history
FIXES: #10580
  • Loading branch information
MapTo0 committed Jan 17, 2025
1 parent e263974 commit c8272f1
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
25 changes: 25 additions & 0 deletions packages/main/cypress/specs/RatingIndicator.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,29 @@ describe("RatingIndicator", () => {
.should("have.css", "height", "24px");
});
});

describe("RatingIndicator Accessibility", () => {
it("should be able to tab after and before readonly element", () => {
cy.mount(html`
<button>Before</button>
<ui5-rating-indicator value="3" readonly></ui5-rating-indicator>
<button>after</button>
`);

cy.get("button:first").realClick();
cy.focused().should("contain", "Before");

// press tab
cy.realPress("Tab");
cy.realPress("Tab");

cy.focused().should("contain", "after");

// press shift + tab
cy.realPress(["Shift", "Tab"]);
cy.realPress(["Shift", "Tab"]);

cy.focused().should("contain", "Before");
});
});
});
1 change: 0 additions & 1 deletion packages/main/src/RatingIndicator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,6 @@ class RatingIndicator extends UI5Element {

_onkeydown(e: KeyboardEvent) {
if (this.disabled || this.readonly) {
e.preventDefault();
return;
}

Expand Down

0 comments on commit c8272f1

Please sign in to comment.