【发布时间】:2017-08-14 23:44:23
【问题描述】:
我在可聚焦元素中有一个固定元素。当我单击固定元素时,父可聚焦元素应获得焦点。它适用于 Chrome、Edge 和 IE11,但不适用于 Firefox。
.focusable {
background-color: red;
width: 200px;
height: 200px;
}
.focusable:focus {
background-color: blue;
}
.fixed {
top: 200px;
background-color: green;
position: fixed;
height: 100px;
width: 200px;
}
<div class="focusable" tabindex="0">
<div class="fixed">
Parent will not get focus.
</div>
</div>
您知道任何解决方法吗?我想避免处理 mousedown 事件并调用 preventDefault()。
【问题讨论】:
标签: firefox focus css-position