presscustomizr / customizr

Simple and fast WordPress theme designed to help you attract and engage more visitors. Provides a perfect user experience on smartphones. Powers 100k+ active sites around the world. Hundreds of 5-stars reviews received on WordPress.org.
https://presscustomizr.com/customizr
Other
137 stars 66 forks source link

Mobile submenus should expand even when the parent item is not a link #1712

Closed ghost closed 4 years ago

ghost commented 5 years ago

Hi, I read the guide on how to build a menu but I can't solve it. I created the main menu for my site and it works fine. The only thing I don't like is that to open the submenus with mobile devices you have to click on the arrow. I would like the menu to expand even by clicking on the word as it happens in your demo. How can I do? thank you https://pavimentomoderno.it

eri-trabiccolo commented 5 years ago

https://github.com/presscustomizr/customizr/blob/dev/assets/front/js/_parts/_parts_modern/_main_dropdowns.part.js#L305

which means that basically if the user leaves the "#" as menu item URL it works as he/she wants.

Anyways we can "enhance" that code to include even the no href case.

To be honest, though, links without href are supposed to be not clickable...

ghost commented 5 years ago

ok thanks for the quick feedback.

yes that's right, links without href are not supposed to be clickable... but, you'll agree that it's simpler sometimes to make our own interpretation of the W3C specs, than to teach thousands of users a rule they don't really care about ... :)

eri-trabiccolo commented 5 years ago

Well yes but, 1) When you create a menu item WP forces you to specify an URL: to have a menu item without URL you have firstly create it with an URL, then add it to the menu, then expand the menu item in the menu and then remove the URL and save it; 2) links without URL are NOT "navigable" with the keyboard (=> accessibility issue); 3) we have to add more code to allow something which is not really good in terms of w3c specs, accessibility, and that requires the user do all the steps in 1) why should he/she? what's the purpose? who guided this user into this practice?

But anyway, as said, no problem to add more code for that. ;)

ghost commented 5 years ago

yes we'll adapt the code. simpler than explaining all your ( totally relevant ) points.

eri-trabiccolo commented 5 years ago

same in Hueman, as I ported the Customizr code there: https://github.com/presscustomizr/hueman/blob/dev/assets/front/js/_parts/_main_userxp_1_mobile_menu_toggle.part.js#L239