[wp-trac] [WordPress Trac] #41822: Twenty Twelve: Submenus not working on touch screen devices

WordPress Trac noreply at wordpress.org
Fri Sep 8 01:53:19 UTC 2017


#41822: Twenty Twelve: Submenus not working on touch screen devices
---------------------------+------------------------------
 Reporter:  kokkieh        |       Owner:
     Type:  defect (bug)   |      Status:  new
 Priority:  normal         |   Milestone:  Awaiting Review
Component:  Bundled Theme  |     Version:  4.8.1
 Severity:  normal         |  Resolution:
 Keywords:                 |     Focuses:
---------------------------+------------------------------

Comment (by nderevj):

 I created the following workaround (it might not be the safest or most
 elegant):

 {{{
 /* Workaround for: "Twenty Twelve: Submenus not working on touch screen
 devices"
  * See: https://core.trac.wordpress.org/ticket/41822#ticket
  *
  * This workaround disables the click event on parent menu items (items
 that
  * have children) when viewed on a large screen touch device (600px+
 width).
  * This allows the submenu to be displayed. Once displayed either the
 parent or
  * children can be clicked.
  */
 jQuery(document).ready(function( $ ){
     $("#site-navigation .page_item_has_children > a").on("click",
 function(event){
       menuItem = $(event.target).parent();
       menuButton = $("#site-navigation button.menu-toggle");
       if(!menuItem.hasClass("focus") && menuButton.is(":hidden")){
         menuItem.addClass("focus");
         event.preventDefault();
       }
     });
 });
 }}}

 I added this as custom JS in WordPress.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/41822#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list