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

Can't scroll to last collapsed navbar item on mobile when there are many items #12738

Closed
XhmikosR opened this issue Feb 14, 2014 · 39 comments
Closed

Comments

@XhmikosR
Copy link
Member

[Original title: Expanded navbar on mobile (landscape) is cut off]
/CC @mdo

@cvrebert
Copy link
Collaborator

Which platforms+versions?

@cvrebert
Copy link
Collaborator

Also, I presume you're referring to fixed top navbars?

@XhmikosR
Copy link
Member Author

Yeah, sorry forgot to mention the details since I was discussing this with mdo.

Happens with Samsung S4 Android 4.3 FF/built in browser but mdo tried with iphone and he could reproduce. I don't have a jsbin example but you can check http://mpc-hc.org/; the last navbar link, the Donate one doesn't show in landscape mode.

I can also reproduce the issue in Google chrome tools when I emulate Samsung S4 in landscape mode.

I opened the issue as a reminder for mdo, but I'm not sure he'd like to address this upstream. I mean the docs state that one has to either reduce the number of links or use the responsive utilities for this use case.

@cvrebert
Copy link
Collaborator

Actually, that docs note is about the non-mobile fully-horizontal navbar.
Responsive utilities deal with viewport widths, not viewport heights, so they can't help in this case.

@cvrebert cvrebert added this to the v3.2.0 milestone Feb 14, 2014
@cvrebert
Copy link
Collaborator

Confirmed on iOS 7. Testcase: http://jsbin.com/dovil/1

@s4jum4
Copy link

s4jum4 commented Feb 14, 2014

I have an issues with portrait and landscape (Android 2.2.1 - screen 320x480 pixels) doesn't work the scroll in the menu, and also in (Android 4.2.2 - screen 480x854 pixels) landscape, I have the same problem, I can't do the scroll, maybe the problem is this one:

.navbar-collapse {
max-height: 340px;

@cvrebert
Copy link
Collaborator

Regression of #10601.

@DavidVII
Copy link

Any ideas on how to fix this? I've removed the max-height, but it still happens. It seems this has to do with the .navbar-collapse being absolutely positioned.

@JamieLaing
Copy link

Here is a JQuery fix...
$(".navbar-collapse").css({ maxHeight: $(window).height() - $(".navbar-header").height() + "px" });

@mdo
Copy link
Member

mdo commented Mar 7, 2014

I think the only sensible implementation is one that's on top of the core, not in it. We could add a vertical media query based on viewport height, but that's not always going to apply. For example, only fixed headers exhibit this problem, not static ones.

We could unfix the fixed navbars to address this, but that sounds lame at this point. I think our best bet is to punt on this until v4 when we can simplify and improve a bit easier.

Thoughts?

@mdo mdo closed this as completed in b4d66b7 Mar 10, 2014
@mdo mdo mentioned this issue Mar 10, 2014
mrmrs pushed a commit that referenced this issue Mar 10, 2014
* master:
  Replace some images on the Carousel example with some base64 encoded 1x1 gifs
  ugh grunt
  moar grunt
  mo copy
  http://www.youtube.com/watch?v=AJWtLf4-WWs
  grunt
  Copy change
  fix grammar in comment in forms.less
  Fixes #12759
  Fixes #12738
  replace .visible-{size} with .visible-{size}-{display} ; fixes #8869

Conflicts:
	dist/css/bootstrap-theme.css.map
	dist/css/bootstrap.css.map
	docs/assets/js/customize.min.js
	docs/assets/js/raw-files.min.js
	docs/dist/css/bootstrap-theme.css.map
	docs/dist/css/bootstrap.css.map
	less/mixins.less
@JamieLaing
Copy link

I'm not sure who you're requesting thoughts from, but I definitely agree on punting to v4. This is a fixed header only problem, and flipping this over to a Jquery fix is really easy.

@XhmikosR
Copy link
Member Author

Thanks @mdo! I tested this locally and seems to work as expected :)

@alfredyeap
Copy link

Do anyone has the same problem that the Menu item cant be scrolled in
Android 2.3.6 Gingerbread version... (Mobile View)

The listing in the menu exceed the max-height but scroll not coming out/ unable to scroll in the menu.

@alfredyeap
Copy link

@s4jum4 how was your menu? Do you find any solution to the scrolling problem in your Android 2.2.1??

@s4jum4
Copy link

s4jum4 commented Mar 25, 2014

Hi @alfredyeap, currently I have the same issue, apparently this issue appear when we are using the menu with fixed option.

Thanks @JamieLaing, your code is working better for Android 4+

@XhmikosR
Copy link
Member Author

@mdo: I went ahead and tried the latest HEAD on a live site (http://mpc-hc.org/). While on desktop everything works fine in landscape view, on mobile the last navbar item is still hidden. :/

@XhmikosR
Copy link
Member Author

I'm gonna reopen this @mdo since the issue is present, unfortunately.

@XhmikosR XhmikosR reopened this Jun 26, 2014
@juthilo juthilo added this to the v3.2.1 milestone Jul 2, 2014
@mdo mdo closed this as completed Jul 6, 2014
stempler pushed a commit to stempler/bootstrap that referenced this issue Nov 4, 2014
* Removes default max-height from .navbar-collapse (so not every navbar
will get a max-height collapse section)
* Scopes regular 340px max-height to fixed top and bottom navbars only
(those are the only ones that really need a max-height to enable
scrolling)
* Adds a landscape media query for phones to cap the max-height at
200px for fixed navbars"
stempler pushed a commit to stempler/bootstrap that referenced this issue Nov 4, 2014
* master:
  Replace some images on the Carousel example with some base64 encoded 1x1 gifs
  ugh grunt
  moar grunt
  mo copy
  http://www.youtube.com/watch?v=AJWtLf4-WWs
  grunt
  Copy change
  fix grammar in comment in forms.less
  Fixes twbs#12759
  Fixes twbs#12738
  replace .visible-{size} with .visible-{size}-{display} ; fixes twbs#8869

Conflicts:
	dist/css/bootstrap-theme.css.map
	dist/css/bootstrap.css.map
	docs/assets/js/customize.min.js
	docs/assets/js/raw-files.min.js
	docs/dist/css/bootstrap-theme.css.map
	docs/dist/css/bootstrap.css.map
	less/mixins.less
stempler pushed a commit to stempler/bootstrap that referenced this issue Nov 4, 2014
…dth for .navbar-collapse height in landscape devices
@maniqui
Copy link

maniqui commented Feb 19, 2015

Can confirm this affects browsing on Android 2.3.6.

A possible fix taken from this SO answer:
http://stackoverflow.com/a/25060926/2461947

 .navbar-collapse::-webkit-scrollbar {
    width: 20px;
}
.navbar-collapse::-webkit-scrollbar-track {
    background-color: lightgray;
}
.navbar-collapse::-webkit-scrollbar-thumb {
    background-color: lightblue;
}

You can test it here:
http://jsbin.com/badoxekedi

Pros:

  • now you can scroll an overflowed .navbar-collapse

Cons:

  • styles will probably apply to every Webkit-based browsers, not only those old versions (ie. browser on Android 2.3.6) that don't work properly. Not sure if there is a way to scope the fix to old browsers.
  • for the scroll to work, you have to tap on the "scrollbar-track". The "scrollbar-thumb" won't work (ie. you can't drag it as you would expect).

@twbs-lmvtfy
Copy link

Hi @maniqui!

You appear to have posted a live example (http://jsbin.com/gibufafico/edit), which is always a good first step. However, according to Bootlint, your example has some Bootstrap usage errors, which might potentially be causing your issue:

  • line 11, column 5: W013: Bootstrap version might be outdated. Latest version is at least 3.3.2 ; saw what appears to be usage of Bootstrap 3.1.1
  • line 84, column 5: W013: Bootstrap version might be outdated. Latest version is at least 3.3.2 ; saw what appears to be usage of Bootstrap 3.1.1

You'll need to fix these errors and post a revised example before we can proceed further.
Thanks!

(Please note that this is a fully automated comment.)

@maniqui
Copy link

maniqui commented Feb 19, 2015

@twbs-lmvtfy: fixed.

@XhmikosR
Copy link
Member Author

I really need to test this...
On Feb 20, 2015 1:55 AM, "Julián Landerreche" [email protected]
wrote:

@twbs-lmvtfy https://github.com/twbs-lmvtfy: fixed.


Reply to this email directly or view it on GitHub
#12738 (comment).

@carasmo
Copy link

carasmo commented Dec 14, 2015

https://output.jsbin.com/lufuxo == navbar-fixed-top can't get to menu items when the viewport is shorter than the height of the menu on small viewport widths.

@twbs-lmvtfy
Copy link

Hi @carasmo!

You appear to have posted a live example (https://jsbin.com/lufuxo/edit), which is always a good first step. However, according to Bootlint, your example has some Bootstrap usage errors, which might potentially be causing your issue:

  • W002: <head> is missing X-UA-Compatible <meta> tag that disables old IE compatibility modes
  • W003: <head> is missing viewport <meta> tag that enables responsiveness

You'll need to fix these errors and post a revised example before we can proceed further.
Thanks!

(Please note that this is a fully automated comment.)

@XhmikosR
Copy link
Member Author

This is still valid.

I managed to pinpoint the version where this started to break. 3.1.1 works fine, 3.2.0 and on has the problem.

We really need to find a solution for this.

@XhmikosR XhmikosR reopened this May 28, 2016
@XhmikosR
Copy link
Member Author

Actually, scratch that. The issue I see is different than this.

Something changed with the navbar's height.

@zeus2198
Copy link

Adding height and overflow styling with important tag after boostrap css has been included seems to fix problem for me. Here's how :
<style> .navbar .navbar-collapse.in { max-height:300px!important; overflow-y:scroll!important; overflow-x:hidden!important; } </style>

@Narimanr
Copy link

I can confirm @Brozeus solution works.

@the94air
Copy link

the94air commented Dec 5, 2016

yaaa @Brozeus that way works very fine

@betterm
Copy link

betterm commented Dec 12, 2016

@Brozeus solution works

@danispringer
Copy link

danispringer commented Jan 25, 2017

@Brozeus still works. Personally had to change max-height to 340px to avoid jump to height of 300px.

@mikedoubintchik
Copy link

mikedoubintchik commented Feb 9, 2017

Instead of setting a max-height that may be less than optimal you could go with:

.navbar .navbar-collapse.in { max-height: 80vh !important; overflow-y: scroll !important; overflow-x: hidden !important; }

@niftylettuce
Copy link

thanks @allurewebsolutions, including this by default with https://crocodilejs.com

@troytempleman
Copy link

troytempleman commented Jul 24, 2017

This might be even better, so that your nav can go to the bottom if necessary:

.navbar .navbar-collapse.in { max-height: 100vh !important; overflow-y: scroll !important; overflow-x: hidden !important; }

@twbs twbs locked and limited conversation to collaborators Jul 25, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests