0

I am working on a Chrome Extension that works on a specific web page I have. I need to simulate a mouse focus on a tab because I want to open a calendar component from the extension that only opens the calendar when the mouse is on focus on the page. I tried with chrome.tabs.update(TAB_ID, {"active": true}, function(tab){ }); with no success. Please help!

Lolpez
  • 849
  • 8
  • 17
  • Isn't `document.hidden` what you're looking for? Check [this topic](https://stackoverflow.com/questions/1760250/how-to-tell-if-browser-tab-is-active) (In regards to *I want to open a calendar component from the extension that only opens the calendar when the mouse is on focus on the page*) – Adelin Jun 26 '18 at 13:50
  • I would use devtools to investigate the exact events used by the page and then I would dispatch synthetic events on the element that listens to those events like element.dispatchEvent(new MouseEvent('xxx', {bubbles: true})) in your content script. – wOxxOm Jun 26 '18 at 13:55
  • The calendar is using the on focus listener: this.element.on("focus", function () { if (that.options.zindex != null) { $(".calendars-popup").css("z-index", that.options.zindex); } return true;}); – Lolpez Jun 26 '18 at 14:01

0 Answers0