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

NgbNavbar is not documented #4462

Closed
jnizet opened this issue Jan 8, 2023 · 2 comments · Fixed by #4471 · May be fixed by MrDari/HeroTest#5
Closed

NgbNavbar is not documented #4462

jnizet opened this issue Jan 8, 2023 · 2 comments · Fixed by #4471 · May be fixed by MrDari/HeroTest#5

Comments

@jnizet
Copy link
Member

jnizet commented Jan 8, 2023

Bug description:

For dropdowns to look correctly inside a collapsed navbar, the NgbNavbar directive is necessary. It's automatically applied when importing NgbDropdownModule (because its selector is simply .navbar), but when using standalone components, it's far from obvious that this directive needs to be imported, since it's not even documented.

@bastienmoulia
Copy link
Contributor

Demo: https://stackblitz.com/edit/angular-pzelbe?file=src%2Fapp%2Fdropdown-navbar.ts

Should we import NgbNavbar in NgbDropdown?

@maxokorokov
Copy link
Member

maxokorokov commented Jan 10, 2023

Maybe simply replace it with closest()?

This is literally the only place it is used for:

this.display = ngbNavbar ? 'static' : 'dynamic';

This would work just fine:

this.display = this._elementRef.nativeElement.closest('.navbar') ? 'static' : 'dynamic';

jnizet added a commit to jnizet/ng-bootstrap that referenced this issue Jan 20, 2023
The NgbNavbar directive is not removed, but simply deprecated, in order to avoid a breaking change for people who have imported it in their modules or standalone components.

fix ng-bootstrap#4462
@maxokorokov maxokorokov added this to the 14.2.0 milestone May 2, 2023
maxokorokov pushed a commit that referenced this issue May 2, 2023
…4471)

The NgbNavbar directive is not removed, but simply deprecated, in order to avoid a breaking change for people who have imported it in their modules or standalone components.

fix #4462
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment