Open josepharhar opened 1 year ago
This doesn't seem problematic given that beforetoggle
already fires synchronously, but that also makes me wonder if queueing a microtask is worth it. I've raised this in https://github.com/whatwg/html/issues/9046#issuecomment-1752752447.
WebKittens
@annevk
Title of the spec
Fire toggle events using microtasks
URL to the spec
https://github.com/whatwg/html/pull/9775
URL to the spec's repository
https://github.com/whatwg/html
Issue Tracker URL
No response
Explainer URL
https://github.com/whatwg/html/issues/9046
TAG Design Review URL
none
Mozilla standards-positions issue URL
https://github.com/mozilla/standards-positions/issues/901
WebKit Bugzilla URL
No response
Radar URL
No response
Description
The toggle events for the popover attribute and the details element, as well as the close event for dialog elements, currently post a task to the DOM manipulation task source to fire these events asynchronously. This means that the event could fire before or after the next render, which could lead to flaky rendering for one frame. By using microtasks instead, the event will always fire before the next render. This was suggested in this HTML spec issue: https://github.com/whatwg/html/issues/9046