javascript - Wrong activeElement in focus in IE11 -
in ie11 span element in focus state (document.activeelement returns span), element hasn't tabindex attribute , shouldn't in focus.
works fine in chrome , firefox (after click in focus div element tabindex attribute). problem in ie11. btw, cannot reproduce issue on jsbin.

http://i.stack.imgur.com/2qdmj.png
i don't see span in list of elements can focus.
is known problem? how make div tabindex activeelement after clicking on span?
finally found it's unexpected behavior in ie11 , possible bug if span has display: flex. chrome , firefox after click on span return div , ie returns span.
check snippet details. reported on caniuse , should added ie tracker.
document.getelementbyid('d').addeventlistener('click', function() { alert('active element ' + document.activeelement); }); #d { display: flex; } span { display: -ms-flex; display: flex; } <div id='d' tabindex="1"> <div> <span>span</span> </div> </div>
Comments
Post a Comment