Merge pull request #447 from antoinegomez/patch-1

Add support of iframe for keyboard event
This commit is contained in:
DanielApt 2016-03-03 00:22:06 +00:00
commit 7621a2488c

View File

@ -53,10 +53,14 @@ function bindKeyboardHandler(element, i) {
var activeElement = document.activeElement ? document.activeElement : i.ownerDocument.activeElement; var activeElement = document.activeElement ? document.activeElement : i.ownerDocument.activeElement;
if (activeElement) { if (activeElement) {
if (activeElement.tagName === 'IFRAME') {
activeElement = activeElement.contentDocument.activeElement;
} else {
// go deeper if element is a webcomponent // go deeper if element is a webcomponent
while (activeElement.shadowRoot) { while (activeElement.shadowRoot) {
activeElement = activeElement.shadowRoot.activeElement; activeElement = activeElement.shadowRoot.activeElement;
} }
}
if (_.isEditable(activeElement)) { if (_.isEditable(activeElement)) {
return; return;
} }