Visitar URL original
fix(ui5-date-picker,ui5-time-picker): fix readonly announcement and role description by unazko · Pull Request #14072 · UI5/webcomponents · GitHub
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
25 changes: 15 additions & 10 deletions packages/main/cypress/specs/DatePicker.cy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,23 @@ describe("Date Picker Tests", () => {

cy.get<DatePicker>("@datePicker")
.ui5DatePickerGetInnerInput()
.as("input");

cy.get("@input")
.should("be.visible");

cy.get("@input")
.should("have.attr", "aria-roledescription", "Date Input")
.and("have.attr", "aria-haspopup", "grid")
cy.get<DatePicker>("@datePicker")
.shadow()
.find("[ui5-datetime-input]")
.shadow()
.find("input#inner")
.should("have.attr", "aria-haspopup", "grid")
.and("not.have.attr", "aria-controls");

cy.get("@input")
.should("not.have.attr", "aria-expanded");
cy.get<DatePicker>("@datePicker")
.shadow()
.find("[ui5-datetime-input]")
.shadow()
.find("input#inner")
.should("have.attr", "aria-describedby", "descr")
.and("not.have.attr", "aria-roledescription");
});

it("input receives value in format pattern depending on the set language", () => {
Expand Down Expand Up @@ -2112,7 +2117,7 @@ describe("Accessibility", () => {
.find("[ui5-datetime-input]")
.shadow()
.find("span#descr")
.should("have.text", DESCRIPTION);
.should("have.text", `Date Input ${DESCRIPTION}`);
});

it("accessibleDescriptionRef property", () => {
Expand All @@ -2136,7 +2141,7 @@ describe("Accessibility", () => {
.find("[ui5-datetime-input]")
.shadow()
.find("span#descr")
.should("have.text", DESCRIPTION);
.should("have.text", `Date Input ${DESCRIPTION}`);
});
});

Expand Down
2 changes: 1 addition & 1 deletion packages/main/cypress/specs/DateRangePicker.cy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -724,7 +724,7 @@ describe("Accessibility", () => {
.find("[ui5-datetime-input]")
.shadow()
.find("span#descr")
.should("have.text", DESCRIPTION);
.should("have.text", `Date Range Input ${DESCRIPTION}`);
});

it("accessibleDescriptionRef property", () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/main/cypress/specs/DateTimePicker.cy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -693,7 +693,7 @@ describe("Accessibility", () => {
.find("[ui5-datetime-input]")
.shadow()
.find("span#descr")
.should("have.text", DESCRIPTION);
.should("have.text", `Date Time Input ${DESCRIPTION}`);
});

it("accessibleDescriptionRef property", () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/main/cypress/specs/TimePicker.cy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,7 @@ describe("Accessibility", () => {
.find("[ui5-datetime-input]")
.shadow()
.find("span#descr")
.should("have.text", DESCRIPTION);
.should("have.text", `Time Input ${DESCRIPTION}`);
});

it("accessibleDescriptionRef property", () => {
Expand Down
5 changes: 3 additions & 2 deletions packages/main/src/DatePicker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -903,12 +903,13 @@ class DatePicker extends DateComponentBase implements IFormInputElement {
}

get accInfo(): InputAccInfo {
const accessibleDescText = getAllAccessibleDescriptionRefTexts(this) || getEffectiveAriaDescriptionText(this) || "";
const ariaDescription = [this.roleDescription, accessibleDescText].filter(Boolean).join(" ");
return {
"ariaRoledescription": this.roleDescription,
"ariaHasPopup": "grid",
"ariaRequired": this.required,
"ariaLabel": this.ariaLabelText || undefined,
"ariaDescription": getAllAccessibleDescriptionRefTexts(this) || getEffectiveAriaDescriptionText(this) || undefined,
"ariaDescription": ariaDescription || undefined,
};
}

Expand Down
5 changes: 3 additions & 2 deletions packages/main/src/TimePicker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -430,12 +430,13 @@ class TimePicker extends UI5Element implements IFormInputElement {
}

get accInfo(): InputAccInfo {
const accessibleDescText = getAllAccessibleDescriptionRefTexts(this) || getEffectiveAriaDescriptionText(this) || "";
const ariaDescription = [this.roleDescription, accessibleDescText].filter(Boolean).join(" ");
return {
"ariaRoledescription": this.roleDescription,
"ariaHasPopup": "grid",
"ariaRequired": this.required,
"ariaLabel": this.ariaLabelText || undefined,
"ariaDescription": getAllAccessibleDescriptionRefTexts(this) || getEffectiveAriaDescriptionText(this) || undefined,
"ariaDescription": ariaDescription || undefined,
};
}

Expand Down
Loading