Visitar URL original
USWDS- Date Picker: Improve screen reader keyboard navigation by mahoneycm · Pull Request #5374 · uswds/uswds · GitHub
Skip to content
Merged
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
10 changes: 4 additions & 6 deletions packages/usa-date-picker/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -884,7 +884,7 @@ const enhanceDatePicker = (el) => {
"beforeend",
Sanitizer.escapeHTML`
<button type="button" class="${DATE_PICKER_BUTTON_CLASS}" aria-haspopup="true" aria-label="Toggle calendar"></button>
<div class="${DATE_PICKER_CALENDAR_CLASS}" role="dialog" aria-modal="true" hidden></div>
<div class="${DATE_PICKER_CALENDAR_CLASS}" role="application" hidden></div>
<div class="usa-sr-only ${DATE_PICKER_STATUS_CLASS}" role="status" aria-live="polite"></div>`
);

Expand Down Expand Up @@ -1089,11 +1089,11 @@ const renderCalendar = (el, _dateToDisplay) => {
<div class="${CALENDAR_CELL_CLASS} ${CALENDAR_MONTH_LABEL_CLASS}">
<button
type="button"
class="${CALENDAR_MONTH_SELECTION_CLASS}" aria-label="${monthLabel}. Click to select month"
class="${CALENDAR_MONTH_SELECTION_CLASS}" aria-label="${monthLabel}. Select month"
>${monthLabel}</button>
<button
type="button"
class="${CALENDAR_YEAR_SELECTION_CLASS}" aria-label="${focusedYear}. Click to select year"
class="${CALENDAR_YEAR_SELECTION_CLASS}" aria-label="${focusedYear}. Select year"
>${focusedYear}</button>
</div>
<div class="${CALENDAR_CELL_CLASS} ${CALENDAR_CELL_CENTER_ITEMS_CLASS}">
Expand All @@ -1118,7 +1118,6 @@ const renderCalendar = (el, _dateToDisplay) => {

const table = document.createElement("table");
table.setAttribute("class", CALENDAR_TABLE_CLASS);
table.setAttribute("role", "presentation");

const tableHead = document.createElement("thead");
table.insertAdjacentElement("beforeend", tableHead);
Expand All @@ -1138,7 +1137,7 @@ const renderCalendar = (el, _dateToDisplay) => {
Object.keys(daysOfWeek).forEach((key) => {
const th = document.createElement("th");
th.setAttribute("class", CALENDAR_DAY_OF_WEEK_CLASS);
th.setAttribute("scope", "presentation");
th.setAttribute("scope", "col");
th.setAttribute("aria-label", key);
th.textContent = daysOfWeek[key];
tableHeadRow.insertAdjacentElement("beforeend", th);
Expand Down Expand Up @@ -1501,7 +1500,6 @@ const displayYearSelection = (el, yearToDisplay) => {

// create table parent
const yearsTableParent = document.createElement("table");
yearsTableParent.setAttribute("role", "presentation");
yearsTableParent.setAttribute("class", CALENDAR_TABLE_CLASS);

// create table body and table row
Expand Down