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

Dropdown menu not working on touch devices #9484

Closed
gitwebdevseo opened this issue Dec 9, 2016 · 18 comments · Fixed by #9546
Closed

Dropdown menu not working on touch devices #9484

gitwebdevseo opened this issue Dec 9, 2016 · 18 comments · Fixed by #9546
Assignees
Milestone

Comments

@gitwebdevseo
Copy link

gitwebdevseo commented Dec 9, 2016

A few people seem to have raised this issue on the Forum but no feedback from anyone from Zurb.

Here is a codepen to illustrate the problem (on 6.2.4):
http://codepen.io/Byzantium/pen/oYMbmx

On pc/mac the submenu items are clickable and work as you would expect (except giving a 404 within codepen)

On an ipad, if you

  1. Tap one of the parent menu headings the submenu opens
  2. Tap one of the submenu items the submenu closes with no other action

I have only tested on an ipad as that's all I have, but others have used other touch devices and had the same issue.

I'm still learning foundation, so if the problem is with my code then my apologies. I can't see any reason why it should not work, but it does not.

@kwentworth
Copy link

kwentworth commented Dec 14, 2016

I'm seeing this behavior as well. Comparing 6.2.3 to 6.2.4 I removed the following lines (lines 3909-3911 in foundation.js) and only left the return statement :
if (_this.options.closeOnClickInside) { _this._hide($elem); }

This is how the code was in 6.2.3. The menu doesn't hide on click anymore, but at least the link is followed.

@gitwebdevseo
Copy link
Author

It looks to me that this change: https://github.com/zurb/foundation-sites/pull/9472/files
incorporated into the 6.3 release will fix this. I'm not an insider - this is just my personal observation, but it looks like it should do the trick and since 6.3 is out real soon (tomorrow I believe), I'll wait to try that.

@ncoden
Copy link
Contributor

ncoden commented Dec 15, 2016

@gitwebdevseo v6.3.0 is released. Is it still an issue ?

@memoht
Copy link

memoht commented Dec 16, 2016

I encountered this issue reported and discussed in #9293 and thought it was later worked out. The interim fix was to add a "data-close-on-click-inside" => "false" to menus. At one point the issue was fixed (#9338) before 6.3 was released. I just updated to 6.3 and took out this interim fix and the menus aren't working. I just put the fix back in. Really surprised.

@gitwebdevseo
Copy link
Author

@ncoden sorry for the delay in replying - been travelling. I have tried it with a fresh local install of 6.3 and it no longer seems to be a problem - i.e. dropdown menu submenu items are selectable on touch devices - well on the ipad I tried with anyway. I would put up a codepen to illustrate but the jsDelivr CDN links (referenced on this page: https://foundation.zurb.com/sites/docs/installation.html) are not yet actually there, so I can't. It would be good to get those CDN links up!

@gitwebdevseo
Copy link
Author

Actually - I will raise a separate request to get the CDN links populated.

@sinspiral
Copy link
Contributor

sinspiral commented Dec 20, 2016

I'm having this issue too with the 6.3.0 version. I have created two codepens using the same example as on the docs.:

As workaround, the only thing I found it works for me is adding to the '.menu' element the attribute data-close-on-click-inside (see http://codepen.io/sinspiral/pen/zoboPp).

Hope it helps!!

@gitwebdevseo
Copy link
Author

Yes - contrary to what I said in my previous post, I agree with @sinspiral that it is still broke. Did my own codepen here:
http://codepen.io/Byzantium/pen/jVXrpR
clicking on submemu items on pc/mac gets a 404 (as expected / intended) but tapping on submenu items on a touch device produces no action except that the submenu gets closed.

sinspiral pushed a commit to sinspiral/foundation-sites that referenced this issue Dec 21, 2016
sinspiral added a commit to sinspiral/foundation-sites that referenced this issue Dec 21, 2016
The delay on touch devices between the click and touchend event
was preventing the link navigation, as browser security policies
don't allow link navigation on hidden elements.

fixes foundation#9484
@scottporco
Copy link

scottporco commented Feb 1, 2017

thanks @memoht that fixed the issue.
<ul class="menu dropdown menu align-right" data-close-on-click-inside="false" data-dropdown-menu>

@pdaengeli
Copy link

I experienced this problem using v.6.3.0 on an iPad and data-close-on-click-inside="false" came to rescue.

@maclein
Copy link

maclein commented Feb 21, 2017

been facing the same issue. i'm using foundation sass through the cli so it's the latest version (6.3.0) and the dropdown menu items are not clickable on my mobile phone. the data-close-on-click-inside="false" solution mentioned by @memoht worked as a temporary fix for now.

@sashabeep
Copy link

Referencing the same error on android firefox and chrome with 6.3.0
data-close-on-click-inside="false"
changes nothing

@sashabeep
Copy link

Added custom handler for parent menu items

$(".topmenu li:has(ul) > a").click(function(e) {
	e.stopPropagation();
    	e.preventDefault();

		if($(this).hasClass("oneTouch")){
  			$(this).removeClass("oneTouch");
  			window.location = $(this).attr("href");
  		}
		else{
			$(this).addClass("oneTouch");
		}
	});

@kball
Copy link
Contributor

kball commented Apr 3, 2017

@sashabeep are you seeing this in 6.3.1? I believe @sinspiral's PR addressed this

@sashabeep
Copy link

@kball 6.3.0, 6.3.1 not yet tested without my custom handler.
Facing the problem on touchscreen laptop, now i can't access to this machine

@nathanp
Copy link

nathanp commented Apr 13, 2017

@kball @sashabeep 6.3.1 has fixed this issue for me.

@pratibap
Copy link

Hello, I am experiencing this issue still, even though the site I am working on uses Foundation version 6.6.3 . Any insights to fix the issue?

@joeworkman
Copy link
Member

This issue has been mentioned on Foundation Open Source Community. There might be relevant details there:

https://foundation.discourse.group/t/drop-down-menu-disappears-in-tablets/4358/1

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

Successfully merging a pull request may close this issue.