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

Comments

Projects
None yet
3 participants
@mhcpan

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 label Mar 17, 2018

@squidfunk

This comment has been minimized.

Owner

squidfunk commented Mar 17, 2018

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

This comment has been minimized.

mhcpan commented Mar 19, 2018

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

@squidfunk

This comment has been minimized.

Owner

squidfunk commented Mar 21, 2018

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

@squidfunk

This comment has been minimized.

Owner

squidfunk commented Mar 21, 2018

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

@squidfunk

This comment has been minimized.

Owner

squidfunk commented Mar 21, 2018

Fix released as part of 2.7.1

@squidfunk squidfunk closed this Mar 21, 2018

@philmarc

This comment has been minimized.

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

This comment has been minimized.

Owner

squidfunk commented Apr 30, 2018

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