From 8cd673d16a823e18e867c1c0d167a40bfbdda250 Mon Sep 17 00:00:00 2001 From: Jan Miksovsky Date: Fri, 9 Sep 2016 16:44:30 -0700 Subject: [PATCH 1/3] Detect when element focus is obtained as a result of focus being restored to the window. --- iron-button-state.html | 5 ++++- iron-control-state.html | 29 ++++++++++++++++++++++++++++- 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/iron-button-state.html b/iron-button-state.html index 8114e2d..10d3e6e 100644 --- a/iron-button-state.html +++ b/iron-button-state.html @@ -113,7 +113,10 @@ }, _detectKeyboardFocus: function(focused) { - this._setReceivedFocusFromKeyboard(!this.pointerDown && focused); + console.log(this.textContent.trim() + ' detectKeyboardFocus: ' + focused + ' ' + this.pointerDown + ' ' + this.receivedFocusViaWindowRestore); + if (focused && !this.receivedFocusViaWindowRestore) { + this._setReceivedFocusFromKeyboard(!this.pointerDown); + } }, // to emulate native checkbox, (de-)activations from a user interaction fire diff --git a/iron-control-state.html b/iron-control-state.html index f34d057..2bb4629 100644 --- a/iron-control-state.html +++ b/iron-control-state.html @@ -11,6 +11,21 @@ diff --git a/iron-control-state.html b/iron-control-state.html index 2bb4629..f34d057 100644 --- a/iron-control-state.html +++ b/iron-control-state.html @@ -11,21 +11,6 @@