We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
const { JSDOM } = require("jsdom"); const { window: { document } } = new JSDOM(` <!DOCTYPE html> <html> <head> <title>Parcel Sandbox</title> <meta charset="UTF-8" /> </head> <body> <div id="app"><button>Hello, Dave</button></div> </body> </html> `); function handleEvent(event) { console.log(`${event.type} event`, event.target); } const button = document.querySelector('button'); button.addEventListener('focus', handleEvent); button.focus(); button.focus();
https://repl.it/@eps1lonExists/SimpleUnfoldedSequence
Repeated focus does not fire focus event. It seems like this is matching
If new focus target is the currently focused area of a top-level browsing context, then return.
-- https://html.spec.whatwg.org/multipage/interaction.html#focusing-steps
which isn't implemented by jsdom.
https://codesandbox.io/s/repeated-imperative-focus-2gftr
Would it be sufficient to check if previous === this and return if this is true after
previous === this
jsdom/lib/jsdom/living/nodes/HTMLOrSVGElement-impl.js
Line 34 in 529b9f3
? Couldn't find an existing test in https://github.com/web-platform-tests/wpt/tree/master/html/interaction/focus so I would need to add a new one to the upstream folder too, right?
The text was updated successfully, but these errors were encountered:
Fix focusing a focused element to be a no-op
d8bede1
Closes #2621.
Successfully merging a pull request may close this issue.
Basic info:
Minimal reproduction case
https://repl.it/@eps1lonExists/SimpleUnfoldedSequence
How does similar code behave in browsers?
Repeated focus does not fire focus event. It seems like this is matching
-- https://html.spec.whatwg.org/multipage/interaction.html#focusing-steps
which isn't implemented by jsdom.
https://codesandbox.io/s/repeated-imperative-focus-2gftr
Misc
Would it be sufficient to check if
previous === this
and return if this is true afterjsdom/lib/jsdom/living/nodes/HTMLOrSVGElement-impl.js
Line 34 in 529b9f3
? Couldn't find an existing test in https://github.com/web-platform-tests/wpt/tree/master/html/interaction/focus so I would need to add a new one to the upstream folder too, right?
The text was updated successfully, but these errors were encountered: