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 1 commit
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"
<div
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't the correct semantic element be <nav>?

Copy link
Contributor Author

@desig9stein desig9stein Oct 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the app we already have the <nav> element inside, that's why I changed it to div, I removed the role since we are using the semantic <nav> element, and no role is needed for it.

image

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should leave that for the user to decide, we don't know what will be inside, if we change it to nav this means that the drawer can only be used for navigation purposes, if that's what we want. then OK, I will change it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@simeonoff, @damyanpetev, what is your opinion?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@desig9stein I'm saying this because so far, we'd decided by putting role="navigation".

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kdinev you are correct, otherwise I will introduce a breaking change.

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>
</div>
<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
Loading