Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(117)

Unified Diff: third_party/polymer/v1_0/components-chromium/iron-overlay-behavior/iron-overlay-behavior-extracted.js

Issue 2158913007: Roll Polymer from 1.5.0 -> 1.6.0 to pick up native CSS custom props (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/polymer/v1_0/components-chromium/iron-overlay-behavior/iron-overlay-behavior-extracted.js
diff --git a/third_party/polymer/v1_0/components-chromium/iron-overlay-behavior/iron-overlay-behavior-extracted.js b/third_party/polymer/v1_0/components-chromium/iron-overlay-behavior/iron-overlay-behavior-extracted.js
index 4bd7a4c19d71a7eea4d2a224d73d14fe941a5db0..881e9b55473137ee2876fd40e02b613b73b2d0b0 100644
--- a/third_party/polymer/v1_0/components-chromium/iron-overlay-behavior/iron-overlay-behavior-extracted.js
+++ b/third_party/polymer/v1_0/components-chromium/iron-overlay-behavior/iron-overlay-behavior-extracted.js
@@ -6,9 +6,12 @@ Use `Polymer.IronOverlayBehavior` to implement an element that can be hidden or
on top of other content. It includes an optional backdrop, and can be used to implement a variety
of UI controls including dialogs and drop downs. Multiple overlays may be displayed at once.
+See the [demo source code](https://github.com/PolymerElements/iron-overlay-behavior/blob/master/demo/simple-overlay.html)
+for an example.
+
### Closing and canceling
-A dialog may be hidden by closing or canceling. The difference between close and cancel is user
+An overlay may be hidden by closing or canceling. The difference between close and cancel is user
intent. Closing generally implies that the user acknowledged the content on the overlay. By default,
it will cancel whenever the user taps outside it or presses the escape key. This behavior is
configurable with the `no-cancel-on-esc-key` and the `no-cancel-on-outside-click` properties.
@@ -27,6 +30,10 @@ Set the `with-backdrop` attribute to display a backdrop behind the overlay. The
appended to `<body>` and is of type `<iron-overlay-backdrop>`. See its doc page for styling
options.
+In addition, `with-backdrop` will wrap the focus within the content in the light DOM.
+Override the [`_focusableNodes` getter](#Polymer.IronOverlayBehavior:property-_focusableNodes)
+to achieve a different behavior.
+
### Limitations
The element is styled to appear on top of other content by setting its `z-index` property. You
@@ -62,7 +69,8 @@ context. You should place this element as a child of `<body>` whenever possible.
},
/**
- * Set to true to display a backdrop behind the overlay.
+ * Set to true to display a backdrop behind the overlay. It traps the focus
+ * within the light DOM of the overlay.
*/
withBackdrop: {
observer: '_withBackdropChanged',
@@ -327,6 +335,8 @@ context. You should place this element as a child of `<body>` whenever possible.
this._prepareRenderOpened();
this._renderOpened();
} else {
+ // Move the focus before actually closing.
+ this._applyFocus();
this._renderClosed();
}
}.bind(this));
@@ -363,6 +373,9 @@ context. You should place this element as a child of `<body>` whenever possible.
this.refit();
this._finishPositioning();
+ // Move the focus to the child node with [autofocus].
+ this._applyFocus();
+
// Safari will apply the focus to the autofocus element when displayed for the first time,
// so we blur it. Later, _applyFocus will set the focus if necessary.
if (this.noAutoFocus && document.activeElement === this._focusNode) {
@@ -391,8 +404,6 @@ context. You should place this element as a child of `<body>` whenever possible.
* @protected
*/
_finishRenderOpened: function() {
- // Focus the child node with [autofocus]
- this._applyFocus();
this.notifyResize();
this.__isAnimating = false;
@@ -415,8 +426,6 @@ context. You should place this element as a child of `<body>` whenever possible.
// Reset z-index only at the end of the animation.
this.style.zIndex = '';
- this._applyFocus();
-
this.notifyResize();
this.__isAnimating = false;
this.fire('iron-overlay-closed', this.closingReason);

Powered by Google App Engine
This is Rietveld 408576698