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
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"accept" : "The specified file type not supported.",
"defaultError" : "There is an error in the field",
"clearText" : "Clear",
"openCalendarText" : "Open calendar",
"calendarSymbols" : {
"monthNames" : ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"],
"abbrmonthNames" : ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ if (typeof window.DatePickerWidget === 'undefined') {
months: ["January","February","March","April","May","June","July","August","September","October","November","December"],
zero: "0",
clearText: "Clear",
openCalendarText: "Open calendar",
name: "en_US"
},
format: "YYYY-MM-DD",
Expand Down Expand Up @@ -311,6 +312,8 @@ if (typeof window.DatePickerWidget === 'undefined') {

let calendarIcon = document.createElement("div");
calendarIcon.classList.add("cmp-adaptiveform-datepicker__calendar-icon");
calendarIcon.setAttribute("role", "button");
calendarIcon.setAttribute("aria-label", this.#options.locale.openCalendarText);

widget.parentNode.insertBefore(calendarIcon, widget.nextSibling);

Expand Down Expand Up @@ -1152,6 +1155,10 @@ if (typeof window.DatePickerWidget === 'undefined') {
if (clearText) {
defaultOptions.locale.clearText = clearText;
}
var openCalendarText = FormView.LanguageUtils.getTranslatedString(locale, "openCalendarText");
if (openCalendarText) {
defaultOptions.locale.openCalendarText = openCalendarText;
}
var zero = FormView.LanguageUtils.getTranslatedString(locale, "0");
if (zero) {
defaultOptions.locale.zero = zero;
Expand Down
14 changes: 14 additions & 0 deletions ui.tests/test-module/specs/datepicker/datepicker.runtime.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,20 @@ describe("Form Runtime with Date Picker", () => {
})
});
});

it("calendar icon should have role='button' for accessibility", () => {
const [datePicker7, datePicker7FieldView] = Object.entries(formContainer._fields)[0];
cy.get(`#${datePicker7}`).find(".cmp-adaptiveform-datepicker__calendar-icon")
.should("have.attr", "role", "button");
});

it("calendar icon should have aria-label for screen readers", () => {
const [datePicker7, datePicker7FieldView] = Object.entries(formContainer._fields)[0];
cy.get(`#${datePicker7}`).find(".cmp-adaptiveform-datepicker__calendar-icon")
.should("have.attr", "aria-label")
.and("not.be.empty");
});

it("Test dd/MM/yyyy format - verify July is highlighted for 03/07/2025", () => {
// Test the datepicker component configured with dd/MM/yyyy format

Expand Down
Loading