google/material-design-lite

button.js: mouseleave event removes focus from button - breaks accessibility

开放

#4,761 创建于 2016年9月16日

 (4 条评论) (0 个反应) (0 位负责人)HTML (4,926 个派生)batch import
help wantedv1-bug

仓库指标

星标
 (32,173 个星标)
PR 合并指标
 (PR 指标待抓取)

描述

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

贡献者指南