Open motss opened 8 years ago
Hi @motss, I noticed 2 things (see this simplified example http://jsbin.com/hefoluk/6/edit?html,output):
tap
event is fired, document.activeElement
is not updated to be the element tapped yet (press ontap
button and check the log), so you might want to set the tapped element to be focused (event.target.focus()
)onclick
button, focus gets restored, but on the device simulator the outline appears and disappears (even on native elements - very weird); if you hit the TAB key you'll see the focus moves to the right next element.After further tests here http://jsbin.com/hefoluk/8/edit?html,output, I see weird things going on with focus changes:
tap
event, the button is not focused yet when we open the dialog
click
event, the button is focused before we open the dialog (good), is restored after the dialog gets closed, but then it gets blurred right after; that's because IronOverlayManager
listens to tap
in order to cancel the overlay. So what happens is that the tap
outside the dialog closes it and restores the focus, but then the click
still happens outside, causing the final blur
This might be related to this issue as well https://github.com/Polymer/polymer/issues/3483
@azakus FYI
I've created this issue https://github.com/Polymer/polymer/issues/3732
Created a pull-request to fix this issue: See https://github.com/PolymerElements/iron-overlay-behavior/pull/246
Description
When
restore-focus-on-close
is set, therestoreFocusNode
loses focus when overlay closes on emulated device mode on Chrome and mobile devices. However, on desktop,restoreFocusNode
focuses and can be seen with focus ring when overlay closes.Expected outcome
restoreFocusNode
focuses with visible focus ring.Actual outcome
restoreFocusNode
loses focus when overlay closes.Live Demo
http://jsbin.com/popukoruye/edit?html,output
Steps to reproduce
Browsers Affected