button.js: mouseleave event removes focus from button - breaks accessibility
#4761 opened on Sep 16, 2016
Description
What MDL Version are you using? (please be specific, e.g. major.minor.patch) material-design-lite-1.2.1
What browser(s) is this bug affecting (including version)? Chrome, latest
What OS (and version) are you using? OSX, latest
What are the steps to reproduce the bug? Can you create a plunker/codepen/jsfiddle which reproduces it? Create some MDL buttons, eg.
<button class="mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect">
<span>Button 1</span>
</button>
<button class="mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect">
<span>Button 2</span>
</button>
Focus a button and position the mouse over it.
Move the mouse pointer away from the button
What is the expected behavior? The button should still have focus and the user should be able to navigate to the next focusable element using tab key.
What is the actual behavior? THE BUTTON IS NOT FOCUSED The user can not tab to the next focusable element, which breaks accessibility!
Any other information you believe would be useful? The code that causes this is in line 111 in button.js:
this.element_.addEventListener('mouseleave', this.boundButtonBlurHandler);
You should find a strategy to refocus the button if it was focused before mouseleave event