Index: third_party/polymer/components/iron-overlay-behavior/iron-overlay-manager.html |
diff --git a/third_party/polymer/components/iron-overlay-behavior/iron-overlay-manager.html b/third_party/polymer/components/iron-overlay-behavior/iron-overlay-manager.html |
index f27d13f77d83f333f8ab0d5f5d55306698377ba7..2462742f0af29150d63c5f3cb04f3c82795fadc8 100644 |
--- a/third_party/polymer/components/iron-overlay-behavior/iron-overlay-manager.html |
+++ b/third_party/polymer/components/iron-overlay-behavior/iron-overlay-manager.html |
@@ -39,10 +39,10 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN |
*/ |
this._backdropElement = null; |
- // Listen to mousedown or touchstart to be sure to be the first to capture |
- // clicks outside the overlay. |
- var clickEvent = ('ontouchstart' in window) ? 'touchstart' : 'mousedown'; |
- document.addEventListener(clickEvent, this._onCaptureClick.bind(this), true); |
+ // Enable document-wide tap recognizer. |
+ Polymer.Gestures.add(document, 'tap', null); |
+ // Need to have useCapture=true, Polymer.Gestures doesn't offer that. |
+ document.addEventListener('tap', this._onCaptureClick.bind(this), true); |
document.addEventListener('focus', this._onCaptureFocus.bind(this), true); |
document.addEventListener('keydown', this._onCaptureKeyDown.bind(this), true); |
}; |
@@ -122,7 +122,6 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN |
} else { |
this.removeOverlay(overlay); |
} |
- this.trackBackdrop(); |
}, |
/** |
@@ -134,6 +133,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN |
var i = this._overlays.indexOf(overlay); |
if (i >= 0) { |
this._bringOverlayAtIndexToFront(i); |
+ this.trackBackdrop(); |
return; |
} |
var insertionIndex = this._overlays.length; |
@@ -160,6 +160,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN |
// Get focused node. |
var element = this.deepActiveElement; |
overlay.restoreFocusNode = this._overlayParent(element) ? null : element; |
+ this.trackBackdrop(); |
}, |
/** |
@@ -178,6 +179,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN |
if (node && Polymer.dom(document.body).deepContains(node)) { |
node.focus(); |
} |
+ this.trackBackdrop(); |
}, |
/** |
@@ -326,6 +328,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN |
* Returns the deepest overlay in the path. |
* @param {Array<Element>=} path |
* @return {Element|undefined} |
+ * @suppress {missingProperties} |
* @private |
*/ |
_overlayInPath: function(path) { |
@@ -346,12 +349,6 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN |
var overlay = /** @type {?} */ (this.currentOverlay()); |
// Check if clicked outside of top overlay. |
if (overlay && this._overlayInPath(Polymer.dom(event).path) !== overlay) { |
- if (overlay.withBackdrop) { |
- // There's no need to stop the propagation as the backdrop element |
- // already got this mousedown/touchstart event. Calling preventDefault |
- // on this event ensures that click/tap won't be triggered at all. |
- event.preventDefault(); |
- } |
overlay._onCaptureClick(event); |
} |
}, |
@@ -389,12 +386,11 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN |
* @param {!Element} overlay1 |
* @param {!Element} overlay2 |
* @return {boolean} |
+ * @suppress {missingProperties} |
* @private |
*/ |
_shouldBeBehindOverlay: function(overlay1, overlay2) { |
- var o1 = /** @type {?} */ (overlay1); |
- var o2 = /** @type {?} */ (overlay2); |
- return !o1.alwaysOnTop && o2.alwaysOnTop; |
+ return !overlay1.alwaysOnTop && overlay2.alwaysOnTop; |
} |
}; |