Make WordPress Core

Changeset 31910


Ignore:
Timestamp:
03/27/2015 05:47:55 PM (11 years ago)
Author:
helen
Message:

Admin menu: Revert [31720] for swipe open/closed.

This is problematic on any device that uses swipe for history navigation, particularly iOS. It's also quite unrefined from an interaction point of view and would not be material for this release either way.

see #31187.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/js/common.js

    r31908 r31910  
    706706        window.wpResponsive = {
    707707                init: function() {
    708                         var self = this,
    709                                 x, y;
     708                        var self = this;
    710709
    711710                        // Modify functionality based on custom activate/deactivate event
     
    722721                                event.preventDefault();
    723722                                $wpwrap.toggleClass( 'wp-responsive-open' );
    724                                 if ( self.isOpen() ) {
     723                                if ( $wpwrap.hasClass( 'wp-responsive-open' ) ) {
    725724                                        $(this).find('a').attr( 'aria-expanded', 'true' );
    726725                                        $( '#adminmenu a:first' ).focus();
     
    730729                        } );
    731730
    732                         $window.on( 'touchstart.wp-responsive', function( event ) {
    733                                 var touches = event.originalEvent.touches;
    734 
    735                                 if ( 1 !== touches.length ) {
    736                                         return;
    737                                 }
    738 
    739                                 x = touches[0].clientX;
    740                                 y = touches[0].clientY;
    741                         } );
    742 
    743                         $window.on( 'touchend.wp-responsive', function( event ) {
    744                                 var touches = event.originalEvent.changedTouches,
    745                                         isOpen = self.isOpen(),
    746                                         distanceX;
    747 
    748                                 if ( 1 === touches.length && x && y ) {
    749                                         if ( ( window.isRtl && isOpen ) || ( ! window.isRtl && ! isOpen ) ) {
    750                                                 distanceX = touches[0].clientX - x;
    751                                         } else {
    752                                                 distanceX = x - touches[0].clientX;
    753                                         }
    754 
    755                                         if ( distanceX > 30 && distanceX > Math.abs( touches[0].clientY - y ) ) {
    756                                                 $( '#wp-admin-bar-menu-toggle' ).trigger( 'click' );
    757                                         }
    758                                 }
    759 
    760                                 x = y = 0;
    761                         } );
    762 
    763731                        // Add menu events
    764732                        $adminmenu.on( 'click.wp-responsive', 'li.wp-has-submenu > a', function( event ) {
     
    782750                                }
    783751                        });
    784                 },
    785 
    786                 isOpen: function() {
    787                         return $wpwrap.hasClass( 'wp-responsive-open' );
    788752                },
    789753
Note: See TracChangeset for help on using the changeset viewer.