Skip to content

Commit aacd375

Browse files
mryunt02erbilnas
andauthored
feat(calendar): Enhance accessibility by adding visually hidden text … (#940)
### Changes - Added visually hidden text to the navigation buttons for improved accessibility: - `<span class="visually-hidden">Previous Calendar View</span>` was added to the previous button. - `<span class="visually-hidden">Next Calendar View</span>` was added to the next button. ### CSS - Added the following CSS class to hide the text visually while keeping it accessible to screen readers: ```css .visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0; } ### Related Issue Fixes #939 --------- Co-authored-by: Erbil <[email protected]>
1 parent 9b9fa6c commit aacd375

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/components/calendar/bl-calendar.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -511,17 +511,20 @@ export default class BlCalendar extends LitElement {
511511
const showMonthSelected =
512512
this._calendarView === CALENDAR_VIEWS.MONTHS ? "header-text-hover" : "";
513513
const showYearSelected = this._calendarView === CALENDAR_VIEWS.YEARS ? "header-text-hover" : "";
514+
const buttonLabel = this._calendarView === CALENDAR_VIEWS.DAYS ? "Month" : "Year";
514515

515516
return html`<div>
516517
<div class="calendar-content">
517518
<div class="calendar-header">
518519
<bl-button
519520
class="arrow"
521+
label="Previous ${buttonLabel}"
520522
icon="arrow_left"
521523
variant="tertiary"
522524
kind="neutral"
523525
@click="${() => this.setPreviousCalendarView()}"
524-
></bl-button>
526+
>
527+
</bl-button>
525528
<bl-button
526529
variant="tertiary"
527530
kind="neutral"
@@ -539,10 +542,12 @@ export default class BlCalendar extends LitElement {
539542
<bl-button
540543
class="arrow"
541544
icon="arrow_right"
545+
label="Next ${buttonLabel}"
542546
variant="tertiary"
543547
kind="neutral"
544548
@click="${() => this.setNextCalendarView()}"
545-
></bl-button>
549+
>
550+
</bl-button>
546551
</div>
547552
<div class="calendar">${getCalendarView(this._calendarView)}</div>
548553
</div>

0 commit comments

Comments
 (0)