diff --git a/package.json b/package.json index 14021a7..d465162 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "tabs-manager", - "version": "1.0.3", + "version": "1.0.4", "description": "Definition one active tab on multiple tabs scenarios. ", "main": "./lib/index.js", "scripts": { diff --git a/src/caller.ts b/src/caller.ts index ffd2d55..b7b6c73 100644 --- a/src/caller.ts +++ b/src/caller.ts @@ -67,7 +67,11 @@ export class TabsManagerWorkerCaller extends EventEmitter { if (!this.workerInstance) return; window.addEventListener('focus', this.setActiveTab); - document.addEventListener('visibilitychange', this.setActiveTab); + document.addEventListener('visibilitychange', () => { + if (document.visibilityState !== 'hidden') { + this.setActiveTab(); + } + }); window.addEventListener('unload', this.closeWindow); if (document.visibilityState === 'visible') {