Skip to content

Commit 337d97b

Browse files
authored
fix(ui5-button): set "type" property in accessibilityInfo with correct value. (#12759)
Fixes: #12750
1 parent 1304826 commit 337d97b

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

packages/main/cypress/specs/Button.cy.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ import employee from "@ui5/webcomponents-icons/dist/employee.js";
88

99
import {
1010
BUTTON_ARIA_TYPE_EMPHASIZED,
11+
BUTTON_ROLE_DESCRIPTION,
12+
LINK_ROLE_DESCRIPTION,
1113
} from "../../src/generated/i18n/i18n-defaults.js";
1214

1315
describe("Button general interaction", () => {
@@ -589,6 +591,7 @@ describe("Accessibility", () => {
589591
expect(info.description).to.include("Submit form");
590592
expect(info.description).to.include(Button.i18nBundle.getText(BUTTON_ARIA_TYPE_EMPHASIZED));
591593
expect(info.role).to.equal("button");
594+
expect(info.type).to.equal(Button.i18nBundle.getText(BUTTON_ROLE_DESCRIPTION));
592595
expect(info.disabled).to.be.false;
593596
});
594597
});
@@ -602,6 +605,7 @@ describe("Accessibility", () => {
602605
const info = button.accessibilityInfo;
603606

604607
expect(info.role).to.equal("link");
608+
expect(info.type).to.equal(Button.i18nBundle.getText(LINK_ROLE_DESCRIPTION));
605609
expect(info.disabled).to.be.true;
606610
expect(info.description).to.be.undefined;
607611
});

packages/main/cypress/specs/TableCustomAnnouncement.cy.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ describe("Cell Custom Announcement - More details", () => {
8484
}
8585

8686
cy.get("body").then($body => {
87+
debugger;
8788
expect($body.find("#ui5-table-invisible-text").text()).to.equal(expectedText);
8889
});
8990
}
@@ -126,7 +127,7 @@ describe("Cell Custom Announcement - More details", () => {
126127
checkAnnouncement(CONTAINS_CONTROL, true);
127128

128129
cy.realPress("ArrowRight"); // fourth cell focused
129-
checkAnnouncement(`Row1Cell3 . ${CONTAINS_CONTROL}`);
130+
checkAnnouncement(`Button Row1Cell3 . ${CONTAINS_CONTROL}`);
130131
cy.focused().should("have.attr", "aria-colindex", "5")
131132
.should("have.attr", "role", "gridcell");
132133

packages/main/src/Button.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -671,11 +671,11 @@ class Button extends UI5Element implements IButton {
671671
}
672672

673673
get effectiveAccRoleTranslation(): string {
674-
if (this.role === ButtonAccessibleRole.Button) {
674+
if (this.accessibleRole as ButtonAccessibleRole === ButtonAccessibleRole.Button) {
675675
return Button.i18nBundle.getText(BUTTON_ROLE_DESCRIPTION);
676676
}
677677

678-
if (this.role === ButtonAccessibleRole.Link) {
678+
if (this.accessibleRole as ButtonAccessibleRole === ButtonAccessibleRole.Link) {
679679
return Button.i18nBundle.getText(LINK_ROLE_DESCRIPTION);
680680
}
681681

0 commit comments

Comments
 (0)