Window blur and focus events in headful/headless mode
See original GitHub issuePuppeteer doesn’t have any page method to simulate or dispatch blur
and focus
window events.
I was trying to evaluate window.focus();
and window.blur();
but event was not fired.
I was trying to dispatch:
const event = document.createEvent('Event');
event.initEvent('blur', true, false);
window.dispatchEvent(event);
Of course event is not trusted after manual dispatching.
After my PR we have bringToFront
method, which can help with focus in headful, but what about headless. Any suggestions or ideas?
Issue Analytics
- State:
- Created 6 years ago
- Reactions:9
- Comments:6 (1 by maintainers)
Top Results From Across the Web
Window blur and focus events in headful/headless mode #1462
I was trying to evaluate window.focus(); and window.blur(); but event was not fired. I was trying to dispatch: const event ...
Read more >Window: blur event - Web APIs | MDN
The blur event fires when an element has lost focus. The opposite of blur is focus . This event is not cancelable and...
Read more >Focusing: focus/blur - The Modern JavaScript Tutorial
The focus event is called on focusing, and blur – when the element loses the focus. Let's use them for validation of an...
Read more >Input focus and blur firing when window gets focus
I really need the focus() and blur() events not to fire when the window regains focus as it causes a div to quickly...
Read more >Javascript Window Blur() and Window Focus() Method
Javascript Window Blur() method is used to remove focus from the current window. i.e, It sends the new open Window to the background....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@maxwellllll this method is not working in headless.
Try to execute with headless
true
andfalse
.visibilitychange
is not working at headless at all.+1