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

Tapping on page content doesn't auto-close sidebar #252

Closed
nickstenning opened this issue Feb 21, 2017 · 2 comments
Closed

Tapping on page content doesn't auto-close sidebar #252

nickstenning opened this issue Feb 21, 2017 · 2 comments

Comments

@nickstenning
Copy link
Contributor

Originally reported as hypothesis/h#3398 by me.

Steps to reproduce

  1. Visit an annotated page in Mobile Safari on iOS
  2. Open the sidebar
  3. Tap (anywhere) on the content, outside the sidebar.

Expected behaviour

The sidebar should close.

Actual behaviour

The sidebar remains open. If you want to close it you need to tap on the "close" arrow button.

Browser/system information

Mobile Safari, iOS 9.2?

This issue was split out from #2811.

@sean-roberts
Copy link
Contributor

This is the old cursor optimization issue with mobile. Mobile OSs don't register any of the click events unless the element has cursor: 'pointer' specified in CSS. Anchors and buttons natively have this but everything else does not.

The two ways you can solve this problem is

  • add touchstart event listening to sidebar.coffee in addition to the click listening
  • add * {cursor: pointer} to css if the user agent (the browser definition) is a iProduct

I would go with touchstart as it's the easiest/cleanest.

@robertknight
Copy link
Member

robertknight commented Mar 1, 2017

Mobile OSs don't register any of the click events unless the element has cursor: 'pointer' specified in CSS.

I didn't know about the cursor: pointer as a work-around. https://developer.mozilla.org/en/docs/Web/Events/click#Safari_Mobile mentions that adding a no-op onclick handler to the element or its ancestors (except <body>) should also work. I prefer the suggestion involving adding a touchstart event listener though.

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

No branches or pull requests

3 participants