diff --git a/README.md b/README.md index 561026e..2bb8052 100644 --- a/README.md +++ b/README.md @@ -216,6 +216,7 @@ The following events are available: * `tabGroup.on("tab-removed", (tab, tabGroup) => { ... });` * `tabGroup.on("tab-active", (tab, tabGroup) => { ... });` * `tab.on("webview-ready", (tab) => { ... });` +* `tab.on("webview-dom-ready", (tab) => { ... });` * `tab.on("title-changed", (title, tab) => { ... });` * `tab.on("icon-changed", (icon, tab) => { ... });` * `tab.on("active", (tab) => { ... });` diff --git a/index.js b/index.js index 13c2df8..0f615b0 100644 --- a/index.js +++ b/index.js @@ -403,11 +403,14 @@ const TabPrivate = { this.webview.addEventListener("did-finish-load", tabWebviewDidFinishLoadHandler.bind(this), false); - this.webview.addEventListener("dom-ready", function () { + const tabWebviewDomReadyHandler = function (e) { // Remove this once https://github.com/electron/electron/issues/14474 is fixed - webview.blur(); - webview.focus(); - }); + webview.blur(); + webview.focus(); + this.emit("webview-dom-ready", this); + }; + + this.webview.addEventListener("dom-ready", tabWebviewDomReadyHandler.bind(this), false); this.webview.classList.add(this.tabGroup.options.viewClass); if (this.webviewAttributes) {