Skip to content
This repository has been archived by the owner on Dec 19, 2024. It is now read-only.

Loses focus on emulated device mode and mobile devices #195

Open
1 of 8 tasks
motss opened this issue Jun 21, 2016 · 4 comments
Open
1 of 8 tasks

Loses focus on emulated device mode and mobile devices #195

motss opened this issue Jun 21, 2016 · 4 comments

Comments

@motss
Copy link

motss commented Jun 21, 2016

Description

When restore-focus-on-close is set, the restoreFocusNode 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

  • Chrome
  • Firefox
  • Safari 9
  • Safari 8
  • Safari 7
  • Edge
  • IE 11
  • IE 10
@valdrinkoshi
Copy link
Member

Hi @motss, I noticed 2 things (see this simplified example http://jsbin.com/hefoluk/6/edit?html,output):

  • when 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())
  • with 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.

@valdrinkoshi
Copy link
Member

After further tests here http://jsbin.com/hefoluk/8/edit?html,output, I see weird things going on with focus changes:

  • with tap event, the button is not focused yet when we open the dialog
    ontap
  • with 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
    onclick

This might be related to this issue as well Polymer/polymer#3483

@azakus FYI

@valdrinkoshi
Copy link
Member

I've created this issue Polymer/polymer#3732

ruud added a commit to ruud/iron-overlay-behavior that referenced this issue May 29, 2017
@ruud
Copy link

ruud commented May 29, 2017

Created a pull-request to fix this issue: See #246

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants