From c8272f1c345b8d0f78f79ed3ae6dba165d6a723b Mon Sep 17 00:00:00 2001 From: "Martin R. Hristov" Date: Fri, 17 Jan 2025 15:44:23 +0200 Subject: [PATCH] fix(ui5-rating-indicator): allow tab next/prev when readonly FIXES: #10580 --- .../main/cypress/specs/RatingIndicator.cy.ts | 25 +++++++++++++++++++ packages/main/src/RatingIndicator.ts | 1 - 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/packages/main/cypress/specs/RatingIndicator.cy.ts b/packages/main/cypress/specs/RatingIndicator.cy.ts index d11fa3f314fb..1b8fcf77ea4a 100644 --- a/packages/main/cypress/specs/RatingIndicator.cy.ts +++ b/packages/main/cypress/specs/RatingIndicator.cy.ts @@ -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` + + + + `); + + 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"); + }); + }); }); diff --git a/packages/main/src/RatingIndicator.ts b/packages/main/src/RatingIndicator.ts index f53a2b36b067..585d1eb771c8 100644 --- a/packages/main/src/RatingIndicator.ts +++ b/packages/main/src/RatingIndicator.ts @@ -251,7 +251,6 @@ class RatingIndicator extends UI5Element { _onkeydown(e: KeyboardEvent) { if (this.disabled || this.readonly) { - e.preventDefault(); return; }