-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
collapseOnSelect will not collapse, if href prop of Nav.Link is missing #6654
Comments
Workaround, until react-bootstrap/react-bootstrap#6654 is fixed
Can you try passing the https://react-bootstrap.github.io/docs/components/navs#navlink |
With the |
As suggested in react-bootstrap/react-bootstrap#6654 (comment) one should use the "eventKey" prop.
It's used as an identifier if you don't want to pass a href: The docs are lacking in this area and should be updated |
Great, thank @kyletsang for pointing me in the right direction! |
* Update Navbar.tsx Add note to `collapseOnSelect` based on feedback in #6654 * Update Navbar.tsx * Update NavLink.tsx * Update src/Navbar.tsx Co-authored-by: Kyle Tsang <6854874+kyletsang@users.noreply.github.com> --------- Co-authored-by: Kyle Tsang <6854874+kyletsang@users.noreply.github.com>
Prerequisites
Describe the bug
collapseOnSelect
does not have an affect onNavbar
, if theNav.Link
has nohref
prop.Expected behavior
The navigation dropdown should close on click.
To Reproduce
Navbar
with the propcollapseOnSelect
Nav.Link
, but without ahref
prop.It should not close the navigation dropdown menu. Instead it stays open. If the
Nav.Link
has ahref
prop all is working fine.Reproducible Example
https://stackblitz.com/edit/stackblitz-starters-79mzqy?file=src%2FApp.tsx
What browser(s) are you seeing the problem on?
Chrome
What version of React-Bootstrap are you using?
2.8.0
What version of Bootstrap are you using?
5.3.0
Additional context
This bug becomes annoying, if one us using
Nav.Link
with theas
property with a component, that does not need thehref
prop.The text was updated successfully, but these errors were encountered: