material icon indicating copy to clipboard operation
material copied to clipboard

md-button that reveals dialog continues to display focus styled when returned

Open joeyperson opened this issue 11 years ago • 6 comments

It seems like the originating button intermittently gets the gray background when returning from a dialog. https://codepen.io/anon/pen/qORpvo

In the demo it is happening only sometimes, but in another project, it's showing every time.

Focus should be kept, but it should be visually suppressed because it is a mouse event and doesn't require immediate keyboard affordance.

Expected:

  • No focus highlight remains after clicking
  • Press Tab a few times with visible focus
  • Then click anywhere and watch it visible focus disappear

joeyperson avatar Sep 30 '15 20:09 joeyperson

Can confirm, occurs only when clicking on a button that closes the dialog or pressing ESC, when clicking outside the button losses his focus

EladBezalel avatar Oct 01 '15 12:10 EladBezalel

Focus is being sent back to the triggering button on purpose–so that a keyboard or screen reader user will be directed to the correct content. This is the intended behavior.

marcysutton avatar Oct 01 '15 14:10 marcysutton

So @marcysutton this is not a bug and can be closed?

EladBezalel avatar Oct 01 '15 15:10 EladBezalel

Sounds like it! I will close.

marcysutton avatar Oct 01 '15 17:10 marcysutton

On Mac OS X, clicking on push buttons or checkboxes does not steal focus from other controls. They can still be focused via the keyboard, so there's no accessibility issue.

http://sendvid.com/2gweiimg

In my humble opinion, the same is desirable on the web. This can be achieved on push buttons via event.preventDefault() on mousedown.

chriscalo avatar Oct 05 '15 21:10 chriscalo

Unfortunately we do not have the same primitives on the Web as native platforms do. If you're curious about the limitations surrounding this issue, read up on CSS Input Modality. I think Angular Material will have to implement something similar to @alice and @bkardell's prollyfill since the perceived "bug" will just keep coming up again and again and again.

marcysutton avatar Oct 15 '15 17:10 marcysutton