diff --git a/lib/utils/gestures.js b/lib/utils/gestures.js index c195032a1b..b32f596c02 100644 --- a/lib/utils/gestures.js +++ b/lib/utils/gestures.js @@ -112,6 +112,20 @@ const labellable = { 'select': true }; +// Defined at https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#enabling-and-disabling-form-controls:-the-disabled-attribute +/** @type {!Object} */ +const canBeDisabled = { + 'button': true, + 'command': true, + 'fieldset': true, + 'input': true, + 'keygen': true, + 'optgroup': true, + 'option': true, + 'select': true, + 'textarea': true +}; + /** * @param {HTMLElement} el Element to check labelling status * @return {boolean} element can have labels @@ -1051,7 +1065,7 @@ register({ let dy = Math.abs(e.clientY - this.info.y); // find original target from `preventer` for TouchEvents, or `e` for MouseEvents let t = _findOriginalTarget((preventer || e)); - if (!t || t.disabled) { + if (!t || (canBeDisabled[/** @type {!HTMLElement} */(t).localName] && t.hasAttribute('disabled'))) { return; } // dx,dy can be NaN if `click` has been simulated and there was no `down` for `start` diff --git a/test/unit/gestures-elements.js b/test/unit/gestures-elements.js index 9030278899..43b34eb29a 100644 --- a/test/unit/gestures-elements.js +++ b/test/unit/gestures-elements.js @@ -12,6 +12,7 @@ import { Polymer } from '../../lib/legacy/polymer-fn.js'; import { html } from '../../lib/utils/html-tag.js'; import { PolymerElement } from '../../polymer-element.js'; import { GestureEventListeners } from '../../lib/mixins/gesture-event-listeners.js'; +import { addListener } from '../../lib/utils/gestures.js'; Polymer({ _template: html`