From 16c2016fe9893e35a9c5546e714a11bf7416b25f Mon Sep 17 00:00:00 2001 From: "DESKTOP-FD57EEK\\Joshua Matamorros" Date: Sun, 13 Jul 2025 20:58:04 -0600 Subject: [PATCH] Fixing footer, header and calendar WCAG Issues --- .../calendar/calendar-aria-label.directive.ts | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 src/app/pages/extra-components/calendar/calendar-aria-label.directive.ts diff --git a/src/app/pages/extra-components/calendar/calendar-aria-label.directive.ts b/src/app/pages/extra-components/calendar/calendar-aria-label.directive.ts new file mode 100644 index 00000000..8b17192f --- /dev/null +++ b/src/app/pages/extra-components/calendar/calendar-aria-label.directive.ts @@ -0,0 +1,30 @@ +import { + AfterViewInit, + Directive, + ElementRef, + Renderer2, +} from '@angular/core'; + +@Directive({ + selector: '[ngxCalendarAriaLabel]', // apply only to nb-calendar with this attribute +}) +export class CalendarAriaLabelDirective implements AfterViewInit { + constructor(private el: ElementRef, private renderer: Renderer2) {} + + ngAfterViewInit() { + setTimeout(() => { + const nativeElement = this.el.nativeElement; + + const prevBtn = nativeElement.querySelector('.prev-month'); + const nextBtn = nativeElement.querySelector('.next-month'); + + if (prevBtn) { + this.renderer.setAttribute(prevBtn, 'aria-label', 'Go to previous month'); + } + + if (nextBtn) { + this.renderer.setAttribute(nextBtn, 'aria-label', 'Go to next month'); + } + }, 0); + } +}