Skip to content

Commit

Permalink
Setting focus in frame for IE11
Browse files Browse the repository at this point in the history
  • Loading branch information
jolzee committed Mar 20, 2020
1 parent b45f9e8 commit 8cc1e5b
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion public/static/embed-leopard.js
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,15 @@ 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 @@ -255,7 +264,7 @@ function animateLeopard(animationName, callback) {
if (teneoFrame) {
var teneoInputBox = teneoFrame.contentDocument.getElementById('teneo-input-field');
if (teneoInputBox) {
teneoFrame.focus();
leopardFocusIframe(teneoFrame);
teneoInputBox.focus();
teneoInputBox.click();
}
Expand Down

0 comments on commit 8cc1e5b

Please sign in to comment.