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

Sidebar (Menu) behaviour issue #736

Closed
mhcpan opened this issue Mar 14, 2018 · 7 comments
Closed

Sidebar (Menu) behaviour issue #736

mhcpan opened this issue Mar 14, 2018 · 7 comments
Labels
bug Issue reports a bug

Comments

@mhcpan
Copy link

mhcpan commented Mar 14, 2018

Problem in Sidebar (Menu) show/hide with Android device

When browse mkdocs-material powered sites in Android device, menu will be shown when Back button is pressed.

Expected behavior

It is expected previous page should be shown without menu(sidebar).

Actual behavior

Menu/sidebar show up

Steps to reproduce the bug

  1. Open https://squidfunk.github.io/mkdocs-material/ with Android device
  2. Click Menu button at top left corner to show menu
  3. Select "Release" section
  4. Press "Back" button of Android device, previous page with Menu show up

If we check Google Matrial, menu won't be displayed if Back button is pressed.

System information

  • OS: Android 6/7/8
  • Browser: Chrome/Dolphin
@squidfunk squidfunk added the bug Issue reports a bug label Mar 17, 2018
@squidfunk
Copy link
Owner

That's indeed a bug related to the way some browsers handle form field history, as the sidebar is implemented using the checkbox hack so it works without JavaScript. A possible fix would be to unset the field upon page load no matter if it is set or not. However, that will only work if JavaScript is available and there might be a slight flash (page loads, menu is open, menu closes).

@mhcpan
Copy link
Author

mhcpan commented Mar 19, 2018

Thanks for the info. Is it possible to include a configuration flag to allow "unset" the field?

@squidfunk
Copy link
Owner

Theoretically yes, but it's probably better if I included the JavaScript-based fix in the code base anyway.

@squidfunk
Copy link
Owner

autocomplete=off actually does the trick, will provide a fix.

@squidfunk
Copy link
Owner

Fix released as part of 2.7.1

@philmarc
Copy link

philmarc commented Apr 30, 2018

Just FYI, according to W3C, autocomplete=off is not allowed on type="checkbox"

Attribute autocomplete is only allowed when the input type is color, date, datetime-local, email, hidden, month, number, password, range, search, tel, text, time, url, or week.

@squidfunk
Copy link
Owner

Thanks for the FYI - you're absolutely correct. Is there some other option with the same effect? The bug is quite annoying so unless there's a workaround I think it's the best solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue reports a bug
Projects
None yet
Development

No branches or pull requests

3 participants