update components

This commit is contained in:
Luke Pulverenti 2016-02-24 00:36:48 -05:00
parent feb5e91986
commit 4da1e38cc5
26 changed files with 320 additions and 125 deletions

View file

@ -128,6 +128,14 @@ context. You should place this element as a child of `<body>` whenever possible.
value: document
},
/**
* Set to true to enable restoring of focus when overlay is closed.
*/
restoreFocusOnClose: {
type: Boolean,
value: false
},
_manager: {
type: Object,
value: Polymer.IronOverlayManager
@ -179,7 +187,7 @@ context. You should place this element as a child of `<body>` whenever possible.
* @type {Node}
*/
get _focusNode() {
return this._focusedChild || Polymer.dom(this).querySelector('[autofocus]') || this.__firstFocusableNode || this;
return this._focusedChild || Polymer.dom(this).querySelector('[autofocus]') || this;
},
/**
@ -235,7 +243,7 @@ context. You should place this element as a child of `<body>` whenever possible.
},
ready: function() {
// with-backdrop need tabindex to be set in order to trap the focus.
// with-backdrop needs tabindex to be set in order to trap the focus.
// If it is not set, IronOverlayBehavior will set it, and remove it if with-backdrop = false.
this.__shouldRemoveTabIndex = false;
// Used for wrapping the focus on TAB / Shift+TAB.
@ -245,7 +253,7 @@ context. You should place this element as a child of `<body>` whenever possible.
attached: function() {
// Call _openedChanged here so that position can be computed correctly.
if (this._callOpenedWhenReady) {
if (this.opened) {
this._openedChanged();
}
this._observer = Polymer.dom(this).observeNodes(this._onNodesChange);
@ -315,7 +323,6 @@ context. You should place this element as a child of `<body>` whenever possible.
// wait to call after ready only if we're initially open
if (!this._overlaySetup) {
this._callOpenedWhenReady = this.opened;
return;
}
@ -552,28 +559,29 @@ context. You should place this element as a child of `<body>` whenever possible.
this._focusedChild = nodeToSet;
}
}
/**
* Fired after the `iron-overlay` opens.
* @event iron-overlay-opened
*/
/**
* Fired when the `iron-overlay` is canceled, but before it is closed.
* Cancel the event to prevent the `iron-overlay` from closing.
* @event iron-overlay-canceled
* @param {?Event} event The event in case the user pressed ESC or clicked outside the overlay
*/
/**
* Fired after the `iron-overlay` closes.
* @event iron-overlay-closed
* @param {{canceled: (boolean|undefined)}} set to the `closingReason` attribute
*/
};
/** @polymerBehavior */
Polymer.IronOverlayBehavior = [Polymer.IronA11yKeysBehavior, Polymer.IronFitBehavior, Polymer.IronResizableBehavior, Polymer.IronOverlayBehaviorImpl];
/**
* Fired after the `iron-overlay` opens.
* @event iron-overlay-opened
*/
/**
* Fired when the `iron-overlay` is canceled, but before it is closed.
* Cancel the event to prevent the `iron-overlay` from closing.
* @event iron-overlay-canceled
* @param {Event} event The closing of the `iron-overlay` can be prevented
* by calling `event.preventDefault()`. The `event.detail` is the original event that originated
* the canceling (e.g. ESC keyboard event or click event outside the `iron-overlay`).
*/
/**
* Fired after the `iron-overlay` closes.
* @event iron-overlay-closed
* @param {{canceled: (boolean|undefined)}} closingReason Contains `canceled` (whether the overlay was canceled).
*/
</script>