-
-
Notifications
You must be signed in to change notification settings - Fork 79.1k
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
[v4-beta 3] Navbar fixed-top problem and non scrollable or visible drowpdown menu links > bug ? #25205
Comments
Bug reports must include a live demo of the problem. Per our contributing guidelines, please create a reduced test case via CodePen or JS Bin and report back with your link, Bootstrap version, and specific browser and OS details. |
Here the code with a "default navbar" and "drop-down menu links" visible and scrollable. On desktop screen when the page height allows it with "default navbar" the "dropdown links" are visible and accessible. |
Not sure if it's a CSS or JS issue here 🤔 |
I do not know if the problem is .CSS or .JS, but the problem is there. You might consider giving a property when a "dropdown show" comes out of the screen, like for a "default navbar", make sure that if the dropdown links come out of the screen the dropdown menu goes into visible ... Or, although this solution is less convenient for cell phones, to ensure that the links are scrollable inside the menu ??? it would be necessary to understand what makes the scrollable elevator appear in a "navbar default" and add that to "navbar fixed" |
it seems css to me. simplified version with no js: https://codepen.io/anon/pen/PEOqGz if you're willing to sacrifice some ie/edge users, you can always use position: sticky instead of position: fixed... https://caniuse.com/#feat=css-sticky alternatively, you could just add something like max-height:300px;overflow:auto; to the dropdown-menu... I always figured bootstrap would have some sort of sane default for dropdown-menu, but I suppose the ideal dropdown height could drastically differ if you are developing a desktop-only admin application vs universal responsive site. Perhaps a variable in _variables.scss could be created for this purpose? |
Still today with bootstrap v4.0.0-beta.3 in small resolutions (cell phones less than 768px in height) the "dropdown menu" (in a navbar fixed-top) when it contains too many links comes out of the visible area of the screen and makes the links unreachable and invisible . So currently we can not use Bootsrap v4.0.0-beta-3 for these reasons: 719media |
Possible solution of the problem: https://codepen.io/anon/pen/vpWZap It would be nice if there was a block .navbar-header that wraps around here .navbar-brand and .navbar-toggle so as not to calculate which length is higher. In this example navbar is expanded before xl screen so it would be nice if we could detect current breakpoint with js to add |
@poilozorey the intent behind the no JS example was just isolating the cause, not suggesting it would work for your use case. The underlying issue is that if you have a position fixed container that contains a position absolute container (your dropdown), which means the dropdown is not affecting DOM layout. So you need to set a height on the dropdown to get scroll. Using your example, like so: https://codepen.io/anon/pen/eyeezw This is true whether or not you are using popper or not. Coincidentally, you are actually not using popper, as bootstrap docs state |
Ghost180195 I tried to include in your solution a dropdown menu that contains 10 links but it did not work. Would you submit another example with 15 links or more in a dropdown menu in a "navbar fixed-top" to see if the links are visible and accessible on small resolutions (cell phones less 768px in height) ??? 719media For example, try in ... |
Works fine in all screens except xl screen: https://codepen.io/anon/pen/vpWZap In xl screen we should not add Read here about my feature request: |
Final version: |
@poilozorey yes, at some point you have to actually do a little code yourself. you have many options:
https://codepen.io/anon/pen/baYaoG
|
my examples are for .navbar-collapse. |
Is this related to #24920 at all? |
Not really. This issue does not use popper. It is in the nav, which avoids popper here (https://github.com/twbs/bootstrap/blob/v4-dev/js/src/dropdown.js#L150). #24920 is an issue dealing with how popper is calculating the placement of the dropdown |
719media |
I see another problem with "navbar fixed-top". So finally, I do not think that only the "dropdown menu" which contains a lot of links and that it is used with "navbar fixed-top" in small resolution (cell phones less than 768px in height) ... If you adjust the size of the window, you will see the bug of "navbar fixed-top" links coming out of the visible area of the screen. look here Here are also in picture ... We see that the links of the "navbar fixed-top" come out of the visible area of the screen and become invisible and unaccessible. |
@poilozorey I don't think the solution I provided should be applied to bootstrap native. The issue with the link scroll collapse could be fixed by applying af93db2#diff-bfe9dc603f82b0c51ba7430c1fe4c558 which has since survived a few rewrites and currently exists as just a "don't use popper in navbar" form. Perhaps it may be unnecessary now, it looks like it may have been applied back before bootstrap was using display: flex everywhere? I bet it could be removed and whatever exception it was trying to avoid, if it still exists, could just be handled inside of popper. Either way, I'm not sure of the reason for lack of popper in navbar. In my opinion, having some dropdowns use popper, and others not, is worse than just having everything use popper just for maintainability reasons, let alone the advantages that popper generally brings (like it would to your use case). So, in summary, I would propose that:
For now, I really recommend you just use |
719media So ... 4 - added to the class ".fixed-top" the rules "max-height: 100%;" and "overflow: auto" (or "overflow-y: auto;"). Indeed, the navigation bar is broken. Do you have the kindness to show me an example on CodePen for example? |
Closing this as a stale issue that's also not a bug. Adding some navbar overflow scrolling is being tracked in another issue at #24796. |
i fixed it with overflow:hidden in the content block |
Hello
There is a problem with the menu "dropdown" in navbar "fixed-top" and the small resolutions (cell phone or smartphone).
When the dropdown menu contains, for example, more than 10 links (categories or other ...), on small resolutions (less than 768px in height) the menu comes out of the visible area of the screen.
The navigation bar is "fixed" and does not move, there is no scroll to get the links of the drop-down menu (drowpdown) that are outside the visible area and these links are invisible or not scrollable.
Is there a way to make menu links visible or scrollable?
Look at the examples below
On desktop screen we can see the 10 links of the dropdown menu
But on cell phone (less than 768px in height) the links are inaccessible and invisible (no scrolls possible).
Firefox (same think on Chrome) desktop large screen :



Smart phone resolution (less than 768px) height :
Smart phone resolution (less than 768px) width :
The text was updated successfully, but these errors were encountered: