Skip to content

Commit

Permalink
IE iframe focus changes
Browse files Browse the repository at this point in the history
  • Loading branch information
jolzee committed Mar 20, 2020
1 parent 8cc1e5b commit a778411
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
32 changes: 16 additions & 16 deletions public/static/embed-leopard.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,15 @@ document.documentElement.style.setProperty(
"".concat(leopardViewHeight, "px")
);

function leopardFocusIframe(iframeEl) {
if (iframeEl.contentWindow) {
iframeEl.contentWindow.focus();
} else if (iframeEl.contentDocument && iframeEl.contentDocument.documentElement) {
// For old versions of Safari
iframeEl.contentDocument.documentElement.focus();
}
}

function loadLeopard() {
var leopardTargetElement = document.getElementById("leopardChatWindow");
if (leopardTargetElement) {
Expand All @@ -186,12 +195,12 @@ function checkLeopardButtonFocus() {
if (teneoFrame && document.activeElement === teneoFrame) {
var teneoContainer = document.getElementById("teneo-chat-widget-container");
if (teneoContainer && teneoContainer.className === "teneo-chat-button-widget") {
var leopardFrameInnerButtonEl = teneoFrame.contentDocument.getElementById('leopard-embed-open-close-button');
if (leopardFrameInnerButtonEl) {
teneoFrame.focus();
leopardFrameInnerButtonEl.focus();
}
var leopardFrameInnerButtonEl = teneoFrame.contentDocument.getElementById('leopard-embed-open-close-button');
if (leopardFrameInnerButtonEl) {
leopardFocusIframe(teneoFrame);
leopardFrameInnerButtonEl.focus();
}
}
}
}

Expand Down Expand Up @@ -227,15 +236,6 @@ function getLeopardElementHeight() {
return wantedHeight;
}

function leopardFocusIframe(iframeEl) {
if (iframeEl.contentWindow) {
iframeEl.contentWindow.focus();
} else if (iframeEl.contentDocument && iframeEl.contentDocument.documentElement) {
// For old versions of Safari
iframeEl.contentDocument.documentElement.focus();
}
}

function animateLeopard(animationName, callback) {

var node = document.getElementById("teneo-chat-widget-container");
Expand Down Expand Up @@ -348,8 +348,8 @@ function receiveLeopardMessage(event) {
if (leopardFrame) {
var leopardFrameInnerButton = leopardFrame.contentDocument.getElementById('leopard-embed-open-close-button');
if (leopardFrameInnerButton) {
leopardFrame.focus();
leopardFrameInnerButton.focus();
leopardFocusIframe(leopardFrame);
leopardFrameInnerButton.focus();
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/ChatInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ export default {
) {
document.activeElement.blur();
}
}, 300);
}, 1000);
},
toggleShowPassword() {
logger.debug("Toggeling Password");
Expand Down

0 comments on commit a778411

Please sign in to comment.