Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(navigation-drawer): fix ARIA role issue warning. #14976

Merged
merged 4 commits into from
Nov 4, 2024
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
[class.igx-nav-drawer--disable-animation]="disableAnimation"
(click)="close()" #overlay>
</div>
<aside role="navigation"
<nav
class="igx-nav-drawer__aside"
[class.igx-nav-drawer__aside--collapsed]="!miniTemplate && !isOpen"
[class.igx-nav-drawer__aside--mini]="miniTemplate && !isOpen"
Expand All @@ -24,5 +24,5 @@
[class.igx-nav-drawer--disable-animation]="disableAnimation">

<ng-container *ngTemplateOutlet="template || defaultItemsTemplate"></ng-container>
</aside>
</nav>
<div class="igx-nav-drawer__style-dummy" #dummy></div>
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ describe('Navigation Drawer', () => {
fixture.detectChanges();

expect(fixture.componentInstance.navDrawer.hasAnimateWidth).toBeTruthy();
expect(fixture.debugElement.query((x) => x.nativeNode.nodeName === 'ASIDE').nativeElement.classList)
expect(fixture.debugElement.query(By.css('.igx-nav-drawer__aside')).nativeElement.classList)
.toContain('igx-nav-drawer__aside--mini');
}).catch((reason) => Promise.reject(reason));
}));
Expand Down Expand Up @@ -262,7 +262,7 @@ describe('Navigation Drawer', () => {
fixture.detectChanges();

expect(fixture.componentInstance.navDrawer.pin).toBeTruthy();
expect(fixture.debugElement.query((x) => x.nativeNode.nodeName === 'ASIDE').nativeElement.classList)
expect(fixture.debugElement.query(By.css('.igx-nav-drawer__aside')).nativeElement.classList)
.toContain('igx-nav-drawer__aside--pinned');

expect(fixture.componentInstance.navDrawer.enableGestures).toBe(false);
Expand Down Expand Up @@ -291,7 +291,7 @@ describe('Navigation Drawer', () => {
fixture.detectChanges();
const windowHeight = window.innerHeight;
const container = fixture.debugElement.query(By.css('div')).nativeElement;
const navdrawer = fixture.debugElement.query(By.css('igx-nav-drawer > aside')).nativeElement;
const navdrawer = fixture.debugElement.query(By.css('igx-nav-drawer > .igx-nav-drawer__aside')).nativeElement;

fixture.componentInstance.pin = false;
fixture.detectChanges();
Expand Down Expand Up @@ -484,7 +484,7 @@ describe('Navigation Drawer', () => {
fixture.detectChanges();

// const comp: DebugElement = fixture.debugElement.query(By.component(IgxNavbarComponent));
const asideElem = fixture.debugElement.query(By.css('igx-nav-drawer > aside')).nativeElement;
const asideElem = fixture.debugElement.query(By.css('igx-nav-drawer > .igx-nav-drawer__aside')).nativeElement;

const computedStyle = window.getComputedStyle(asideElem);
let asideWidth = computedStyle.getPropertyValue('width');
Expand Down
74 changes: 35 additions & 39 deletions src/app/app.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,58 +5,54 @@
[(pin)]="drawerState.pin" [position]="drawerState.position">

<ng-template igxDrawer>
<nav>
<div class="nav-header"></div>
<div class="nav-header"></div>

<!-- Components -->
<span igxDrawerItem [isHeader]="true">Components</span>
<!-- Components -->
<span igxDrawerItem [isHeader]="true">Components</span>

<span *ngFor="let item of componentLinks" igxDrawerItem igxRipple routerLinkActive="igx-nav-drawer__item--active" routerLink="{{item.link}}">
<igx-icon>{{item.icon}}</igx-icon>
<span class="navdrawer-ellipsis">{{item.name}}</span>
</span>
<span *ngFor="let item of componentLinks" igxDrawerItem igxRipple routerLinkActive="igx-nav-drawer__item--active" routerLink="{{item.link}}">
<igx-icon>{{item.icon}}</igx-icon>
<span class="navdrawer-ellipsis">{{item.name}}</span>
</span>

<span igxDrawerItem [disabled]="true">
<igx-icon>web</igx-icon>
<span class="navdrawer-ellipsis">Disabled Item</span>
</span>
<span igxDrawerItem [disabled]="true">
<igx-icon>web</igx-icon>
<span class="navdrawer-ellipsis">Disabled Item</span>
</span>

<!--Directives-->
<span igxDrawerItem [isHeader]="true">Directives</span>
<!--Directives-->
<span igxDrawerItem [isHeader]="true">Directives</span>

<span *ngFor="let item of directiveLinks" igxDrawerItem igxRipple routerLinkActive="igx-nav-drawer__item--active" routerLink="{{item.link}}">
<igx-icon>{{item.icon}}</igx-icon>
<span class="navdrawer-ellipsis">{{item.name}}</span>
</span>
<span *ngFor="let item of directiveLinks" igxDrawerItem igxRipple routerLinkActive="igx-nav-drawer__item--active" routerLink="{{item.link}}">
<igx-icon>{{item.icon}}</igx-icon>
<span class="navdrawer-ellipsis">{{item.name}}</span>
</span>

<!--Style guide-->
<span igxDrawerItem [isHeader]="true">Style</span>
<!--Style guide-->
<span igxDrawerItem [isHeader]="true">Style</span>

<span *ngFor="let item of styleLinks" igxDrawerItem igxRipple routerLinkActive="igx-nav-drawer__item--active" routerLink="{{item.link}}">
<igx-icon>{{item.icon}}</igx-icon>
<span class="navdrawer-ellipsis">{{item.name}}</span>
</span>
</nav>
<span *ngFor="let item of styleLinks" igxDrawerItem igxRipple routerLinkActive="igx-nav-drawer__item--active" routerLink="{{item.link}}">
<igx-icon>{{item.icon}}</igx-icon>
<span class="navdrawer-ellipsis">{{item.name}}</span>
</span>
</ng-template>

<ng-template *ngIf="drawerState.miniVariant" igxDrawerMini>
<nav>
<span *ngFor="let item of componentLinks" igxRipple igxDrawerItem routerLinkActive #rla="routerLinkActive" [active]="rla.isActive" routerLink="{{item.link}}">
<igx-icon>{{item.icon}}</igx-icon>
</span>
<span *ngFor="let item of componentLinks" igxRipple igxDrawerItem routerLinkActive #rla="routerLinkActive" [active]="rla.isActive" routerLink="{{item.link}}">
<igx-icon>{{item.icon}}</igx-icon>
</span>

<span igxDrawerItem [disabled]="true">
<igx-icon>web</igx-icon>
</span>
<span igxDrawerItem [disabled]="true">
<igx-icon>web</igx-icon>
</span>

<span *ngFor="let item of directiveLinks" igxDrawerItem igxRipple routerLinkActive #rla="routerLinkActive" [active]="rla.isActive" routerLink="{{item.link}}">
<igx-icon>{{item.icon}}</igx-icon>
</span>
<span *ngFor="let item of directiveLinks" igxDrawerItem igxRipple routerLinkActive #rla="routerLinkActive" [active]="rla.isActive" routerLink="{{item.link}}">
<igx-icon>{{item.icon}}</igx-icon>
</span>

<span *ngFor="let item of styleLinks" igxDrawerItem igxRipple routerLinkActive #rla="routerLinkActive" [active]="rla.isActive" routerLink="{{item.link}}">
<igx-icon>{{item.icon}}</igx-icon>
</span>
</nav>
<span *ngFor="let item of styleLinks" igxDrawerItem igxRipple routerLinkActive #rla="routerLinkActive" [active]="rla.isActive" routerLink="{{item.link}}">
<igx-icon>{{item.icon}}</igx-icon>
</span>
</ng-template>
</igx-nav-drawer>

Expand Down
Loading