Skip to content

Touch devices dropdown support#965

Merged
tiagonoronha merged 4 commits intomasterfrom
fix/962
Sep 21, 2018
Merged

Touch devices dropdown support#965
tiagonoronha merged 4 commits intomasterfrom
fix/962

Conversation

@tiagonoronha
Copy link
Copy Markdown
Contributor

Adds touch support for navigation dropdowns when using an handheld device such as an iPad.

How to test:

  1. Create a menu with dropdowns and assign it to the "Primary navigation" area.

  2. Use an iPad or switch Chrome to mobile mode and select the iPad Pro from the list of devices (if using Chrome, reload the page after switching to the iPad).

  3. Tap on the drop down to open it. The first tap should open the dropdown. A second tap on the same item should navigate away to the correct page.

Closes #962.

@tiagonoronha tiagonoronha added the status: needs review PR that needs review label Sep 18, 2018
Copy link
Copy Markdown
Contributor

@peterfabian peterfabian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one note, otherwise works fine.

Comment thread assets/js/navigation.js Outdated
} );

// Ensure the dropdowns close when user taps outside the site header
[].forEach.call( document.querySelectorAll( '.site-content, .header-widget-region, .site-footer' ), function( element ) {
Copy link
Copy Markdown
Contributor

@peterfabian peterfabian Sep 19, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The dropdown does not close if the user clicks in the header area, e.g. to search products via the input, etc. It's not critical, but would be nice if that behaved in the same way as when clicking somewhere else on the page.

@tiagonoronha
Copy link
Copy Markdown
Contributor Author

@peterfabian It's really trick to allow for clicks inside the header area because I would need to basically listen to events on all elements, but I made a change that target a few elements in the Header so, for example, clicking on the search input, will close the dropdown.

Copy link
Copy Markdown
Contributor

@peterfabian peterfabian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, much better now.

@tiagonoronha tiagonoronha added Status: Approved and removed status: needs review PR that needs review labels Sep 21, 2018
@tiagonoronha tiagonoronha merged commit a804a4b into master Sep 21, 2018
@tiagonoronha tiagonoronha deleted the fix/962 branch September 21, 2018 10:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants