2 * @demo demo/index.html
5 Polymer.IronControlState = {
10 * If true, the element currently has focus.
17 reflectToAttribute: true
21 * If true, the user cannot interact with this element.
27 observer: '_disabledChanged',
28 reflectToAttribute: true
35 _boundFocusBlurHandler: {
38 return this._focusBlurHandler.bind(this);
45 '_changedControlState(focused, disabled)'
49 this.addEventListener('focus', this._boundFocusBlurHandler, true);
50 this.addEventListener('blur', this._boundFocusBlurHandler, true);
53 _focusBlurHandler: function(event) {
54 var target = event.path ? event.path[0] : event.target;
55 if (target === this) {
56 var focused = event.type === 'focus';
57 this._setFocused(focused);
58 } else if (!this.shadowRoot) {
59 this.fire(event.type, {sourceEvent: event}, {
61 bubbles: event.bubbles,
62 cancelable: event.cancelable
67 _disabledChanged: function(disabled, old) {
68 this.setAttribute('aria-disabled', disabled ? 'true' : 'false');
69 this.style.pointerEvents = disabled ? 'none' : '';
71 this._oldTabIndex = this.tabIndex;
74 } else if (this._oldTabIndex !== undefined) {
75 this.tabIndex = this._oldTabIndex;
79 _changedControlState: function() {
80 // _controlStateChanged is abstract, follow-on behaviors may implement it
81 if (this._controlStateChanged) {
82 this._controlStateChanged();