Skip to content
This repository was archived by the owner on Jan 13, 2025. It is now read-only.
This repository was archived by the owner on Jan 13, 2025. It is now read-only.

Simple menu not dismissed when touching rest of screen on iOS (iPad) #843

Closed
@pgbross

Description

@pgbross

What MDC-Web Version are you using?

0.13.0

What browser(s) is this bug affecting?

iOS 10 Safari
Mozilla/5.0 (iPad; CPU OS 10_3_3 like Mac OS X) AppleWebKit/603.3.4 (KHTML, like Gecko) Mobile/14G5047a

What OS are you using?

iOS 10.3.3

What are the steps to reproduce the bug?

  1. On the iPad, goto https://material-components-web.appspot.com/simple-menu.html
  2. Touch "REVEAL MENU" button to open the menu
  3. Touch the screen off the menu to dismiss it.
  4. Observe the menu is not closed.

What is the expected behavior?

The menu should close when touching elsewhere on the screen.

What is the actual behavior?

The body click event is not fired, so the menu remains open, forcing you to pick a menu action/item.

Any other information you believe would be useful?

Click events normally do not bubble up to the html or body tags in iOS. If the body tag has a CSS cursor property set to pointer, a click event will after a delay eventually bubble, but this is too slow to be a feasible workaround.
Including a 'touchstart' as well as a 'click' handler in the simple menu registerBodyClickHandler() method will let the menu perform correctly, but this then means all adapter users would have to remember to do something similar. A better solution might be a breaking change to have the adapter have a registerBodyInteractionHandler( /* type: string, handler: EventListener */) and then the foundation could register multiple event types to watch for. (cf. mdc-menu that takes this approach with its registerBodyInteractionHandler())

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions