Make WordPress Core

Changeset 31914


Ignore:
Timestamp:
03/27/2015 10:53:50 PM (9 years ago)
Author:
ocean90
Message:

Theme Switcher: Opening themes details modal shouldn't require two clicks on touch devices.

Inspired by [26838].

see #31794.

File:
1 edited

Legend:

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

    r31893 r31914  
    18481848    api.ThemeControl = api.Control.extend({
    18491849
     1850        touchDrag: false,
     1851
    18501852        /**
    18511853         * @since 4.2.0
     
    18541856            var control = this;
    18551857
     1858            control.container.on( 'touchmove', '.theme', function() {
     1859                control.touchDrag = true;
     1860            });
     1861
    18561862            // Bind details view trigger.
    1857             control.container.on( 'click keydown', '.theme', function( event ) {
     1863            control.container.on( 'click keydown touchend', '.theme', function( event ) {
    18581864                if ( api.utils.isKeydownButNotEnterEvent( event ) ) {
    18591865                    return;
    18601866                }
    18611867
    1862                 if ( 'button' === event.target.className ) {
     1868                // Bail if the user scrolled on a touch device.
     1869                if ( control.touchDrag === true ) {
     1870                    return control.touchDrag = false;
     1871                }
     1872
     1873                // Prevent the modal from showing when the user clicks the action button.
     1874                if ( $( event.target ).is( '.theme-actions .button' ) ) {
    18631875                    return;
    18641876                }
Note: See TracChangeset for help on using the changeset viewer.