Skip to content

Commit

Permalink
fix(ui5-daypicker): announce selected state change (#9934)
Browse files Browse the repository at this point in the history
Fixes: #9860
  • Loading branch information
unazko authored Oct 8, 2024
1 parent 610de0f commit cd7e202
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/main/src/DayPicker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import i18n from "@ui5/webcomponents-base/dist/decorators/i18n.js";
import getLocale from "@ui5/webcomponents-base/dist/locale/getLocale.js";
import type LocaleData from "@ui5/webcomponents-localization/dist/LocaleData.js";
import getCachedLocaleDataInstance from "@ui5/webcomponents-localization/dist/getCachedLocaleDataInstance.js";
import InvisibleMessageMode from "@ui5/webcomponents-base/dist/types/InvisibleMessageMode.js";
import announce from "@ui5/webcomponents-base/dist/util/InvisibleMessage.js";
import type I18nBundle from "@ui5/webcomponents-base/dist/i18nBundle.js";
import {
isSpace,
Expand Down Expand Up @@ -44,6 +46,7 @@ import {
DAY_PICKER_WEEK_NUMBER_TEXT,
DAY_PICKER_NON_WORKING_DAY,
DAY_PICKER_TODAY,
LIST_ITEM_SELECTED,
} from "./generated/i18n/i18n-defaults.js";

// Template
Expand Down Expand Up @@ -476,6 +479,7 @@ class DayPicker extends CalendarPart implements ICalendarPicker {
return;
}

announce(DayPicker.i18nBundle.getText(LIST_ITEM_SELECTED), InvisibleMessageMode.Assertive);
if (this.selectionMode === CalendarSelectionMode.Range && this.selectedDates.length === 1) {
this.selectedDates = [this.selectedDates[0], timestamp];
return;
Expand Down Expand Up @@ -520,6 +524,7 @@ class DayPicker extends CalendarPart implements ICalendarPicker {
this._removeTimestampFromSelection(timestamp);
} else {
this._addTimestampToSelection(timestamp);
announce(DayPicker.i18nBundle.getText(LIST_ITEM_SELECTED), InvisibleMessageMode.Assertive);
}
}

Expand Down

0 comments on commit cd7e202

Please sign in to comment.