adding main and aria label to controls

This commit is contained in:
DESKTOP-FD57EEK\Joshua Matamorros 2025-07-14 19:16:49 -06:00
parent 1fb348c832
commit 46e67b704f
8 changed files with 44 additions and 5 deletions

View file

@ -14,7 +14,7 @@
<nb-actions size="small">
<nb-action class="control-item">
<nb-search type="rotate-layout"></nb-search>
<nb-search ngxSearchAriaLabel type="rotate-layout"></nb-search>
</nb-action>
<nb-action class="control-item" icon="email-outline"></nb-action>
<nb-action class="control-item" icon="bell-outline"></nb-action>

View file

@ -0,0 +1,22 @@
import { Directive, ElementRef, AfterViewInit } from '@angular/core';
@Directive({
selector: '[ngxSearchAriaLabel]',
})
export class SearchAriaLabelDirective implements AfterViewInit {
constructor(private el: ElementRef) {}
ngAfterViewInit() {
const nativeElement: HTMLElement = this.el.nativeElement;
// Add aria-labels to internal buttons
const buttons = nativeElement.querySelectorAll('button');
buttons.forEach((btn, i) => {
if (btn && !btn.hasAttribute('aria-label')) {
if (btn.classList.contains('start-search')) {
btn.setAttribute('aria-label', 'Search');
}
}
});
}
}

View file

@ -14,7 +14,9 @@ import { Component } from '@angular/core';
</nb-sidebar>
<nb-layout-column>
<ng-content select="router-outlet"></ng-content>
<main>
<ng-content select="router-outlet"></ng-content>
</main>
</nb-layout-column>
<nb-layout-footer fixed>

View file

@ -38,6 +38,7 @@ import { DEFAULT_THEME } from './styles/theme.default';
import { COSMIC_THEME } from './styles/theme.cosmic';
import { CORPORATE_THEME } from './styles/theme.corporate';
import { DARK_THEME } from './styles/theme.dark';
import {SearchAriaLabelDirective} from './components/search-aria-label.directive';
const NB_MODULES = [
NbLayoutModule,
@ -61,6 +62,7 @@ const COMPONENTS = [
OneColumnLayoutComponent,
ThreeColumnsLayoutComponent,
TwoColumnsLayoutComponent,
SearchAriaLabelDirective,
];
const PIPES = [
CapitalizePipe,

View file

@ -6,8 +6,8 @@ import {
NbLogoutComponent,
NbRegisterComponent,
NbRequestPasswordComponent,
NbResetPasswordComponent,
} from '@nebular/auth';
import {CustomResetPasswordComponent} from './pages/auth/reset-password/custom-reset-password.component';
export const routes: Routes = [
{
@ -41,7 +41,7 @@ export const routes: Routes = [
},
{
path: 'reset-password',
component: NbResetPasswordComponent,
component: CustomResetPasswordComponent,
},
],
},

View file

@ -20,9 +20,10 @@ import {
NbToastrModule,
NbWindowModule,
} from '@nebular/theme';
import {CustomResetPasswordComponent} from './pages/auth/reset-password/custom-reset-password.component';
@NgModule({
declarations: [AppComponent],
declarations: [AppComponent, CustomResetPasswordComponent],
imports: [
BrowserModule,
BrowserAnimationsModule,

View file

@ -0,0 +1,3 @@
<main>
<nb-reset-password-page></nb-reset-password-page>
</main>

View file

@ -0,0 +1,9 @@
import {Component} from '@angular/core';
import {NbResetPasswordComponent} from '@nebular/auth';
@Component({
templateUrl: './custom-reset-password.component.html',
})
export class CustomResetPasswordComponent extends NbResetPasswordComponent {
}