Skip to content
8 changes: 3 additions & 5 deletions packages/ai/cypress/specs/Button.cy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,16 @@ describe("Accessibility", () => {
.ui5AIButtonCheckAttributeSplitButtonRoot("aria-haspopup", "menu");
});

it("should set correct aria-roledescription to SplitButton root element", () => {
it("should not set aria-roledescription to SplitButton root element", () => {
cy.mount(
<Button accessibilityAttributes={{ root: { roleDescription: "Open Menu" } }}>
<ButtonState name="generate" text="Generate" icon="ai">Click me</ButtonState>
</Button>
);

cy.get("[ui5-ai-button]")
.ui5AIButtonCheckAttributeSplitButtonRoot("aria-roledescription", "Open Menu");
.shadow().find("[ui5-split-button]").shadow().find(".ui5-split-button-root")
.should("not.have.attr", "aria-roledescription");
});

it("should set correct aria-haspopup to arrow button if shown", () => {
Expand Down Expand Up @@ -94,9 +95,6 @@ describe("Accessibility", () => {
cy.get("@button")
.ui5AIButtonCheckAttributeSplitButtonRoot("aria-haspopup", "false");

cy.get("@button")
.ui5AIButtonCheckAttributeSplitButtonRoot("aria-roledescription", "Split Button");

cy.get("@button")
.ui5AIButtonCheckAttributeInArrowButton("aria-haspopup", "menu");

Expand Down
5 changes: 1 addition & 4 deletions packages/main/src/SplitButton.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import SplitButtonTemplate from "./SplitButtonTemplate.js";
// Styles
import SplitButtonCss from "./generated/themes/SplitButton.css.js";

type SplitButtonRootAccAttributes = Pick<AccessibilityAttributes, "hasPopup" | "roleDescription" | "title" | "ariaKeyShortcuts">;
type SplitButtonRootAccAttributes = Pick<AccessibilityAttributes, "hasPopup" | "title" | "ariaKeyShortcuts">;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we remove the roleDescription from the acc attributes in SplitButton, we should remove it also from ui5-ai-button, because the ui5-ai-button is using ui5-split-button in it's template and the property roleDescription from ui5-ai-button acc attributes will not reflect nowhere. There are some ui5-ai-button samples which are setting the property roleDescription, so they also should be enhanced. Also this regression in the acc behaviour of the ui5-ai-button should be discussed with acc expert. @unazko what do you think about this issue.

type SplitButtonArrowButtonAccAtributes = Pick<AccessibilityAttributes, "hasPopup" | "expanded" | "title">;
type SplitButtonAccessibilityAttributes = {root?: SplitButtonRootAccAttributes, arrowButton?: SplitButtonArrowButtonAccAtributes}

Expand Down Expand Up @@ -224,8 +224,6 @@ class SplitButton extends UI5Element {
* - **root**: Attributes that will be applied to the main (text) button.
* - **hasPopup**: Indicates the presence and type of popup triggered by the button.
* Accepts string values: `"dialog"`, `"grid"`, `"listbox"`, `"menu"`, or `"tree"`.
* - **roleDescription**: Provides a human-readable description for the role of the button.
* Accepts any string value.
* - **title**: Specifies a tooltip or description for screen readers.
* Accepts any string value.
* - **ariaKeyShortcuts**: Defines keyboard shortcuts that activate or give focus to the button.
Expand Down Expand Up @@ -469,7 +467,6 @@ class SplitButton extends UI5Element {
return {
root: {
hasPopup: this.accessibilityAttributes?.root?.hasPopup,
roleDescription: this.accessibilityAttributes?.root?.roleDescription || (this._hideArrowButton ? undefined : SplitButton.i18nBundle.getText(SPLIT_BUTTON_DESCRIPTION)),

@unazko unazko Aug 14, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Тhe issue is already fixed, but I would also remove the aria-roledescription attribute from the SplitButtonTemplate for the group element now as aria-roledescription is not announced by JAWS. We've placed the role description text in the aria-labelledby attribute.

title: this.accessibilityAttributes?.root?.title,
ariaKeyShortcuts: this.accessibilityAttributes?.root?.ariaKeyShortcuts,
},
Expand Down
3 changes: 1 addition & 2 deletions packages/main/src/SplitButtonTemplate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ export default function SplitButtonTemplate(this: SplitButton) {
tabindex={this._tabIndex}
aria-labelledby={!this._hideArrowButton ? `${this._id}-invisibleTextDefault ${this._id}-invisibleText` : undefined}
aria-haspopup={this._computedAccessibilityAttributes?.root?.hasPopup}
aria-roledescription={this._computedAccessibilityAttributes?.root?.roleDescription}
aria-label={this._computedAccessibilityAttributes?.root?.title}
aria-keyshortcuts={this._computedAccessibilityAttributes?.root?.ariaKeyShortcuts}
onFocusOut={this._onFocusOut}
Expand Down Expand Up @@ -56,7 +55,7 @@ export default function SplitButtonTemplate(this: SplitButton) {
onActiveStateChange={this._onArrowButtonActiveStateChange}
>
</Button>
<span id={`${this._id}-invisibleText`} class="ui5-hidden-text">{this.accInfo.keyboardHint} {this.accessibleName}</span>
<span id={`${this._id}-invisibleText`} class="ui5-hidden-text">{this.accessibleName} {this.accInfo.description} {this.accInfo.keyboardHint}</span>
<span id={`${this._id}-invisibleTextDefault`} class="ui5-hidden-text">{this.buttonTextContent}</span>
</>
)}
Expand Down
Loading