[meta] Implement dialog toggleevents for dialog open/close
Categories
(Core :: DOM: Core & HTML, enhancement)
Tracking
()
People
(Reporter: keithamus, Assigned: keithamus)
References
(Blocks 1 open bug, )
Details
(Keywords: dev-doc-complete, meta)
Attachments
(1 file, 1 obsolete file)
Steps to reproduce:
Comment 1•2 years ago
|
||
Hello! Thank you for submitting this issue but could you please post the stepts to reproduce here instead of just the link to git for better visibility of the issue.
Have a nice day!
Updated•2 years ago
|
| Assignee | ||
Comment 2•2 years ago
|
||
This is a tracking issue for implementing beforetoggle and toggle events on <dialog> elements; as proposed in https://github.com/whatwg/html/issues/9733, which was discussed at TPAC. https://github.com/whatwg/html/pull/10091 is the spec PR for this.
Currently <dialog> elements do not emit these events.
Hope that's helpful.
| Assignee | ||
Updated•2 years ago
|
Updated•2 years ago
|
| Assignee | ||
Updated•1 year ago
|
| Assignee | ||
Updated•1 year ago
|
| Assignee | ||
Comment 4•1 year ago
|
||
https://github.com/whatwg/html/pull/10091
This also slightly refactors FireToggleEvent to allow to to
accomodate both popovers and now also dialogs
Comment 7•1 year ago
|
||
| bugherder | ||
Updated•1 year ago
|
Comment 9•1 year ago
|
||
Keith, do you want to nominate this for a release note? (Process info)
| Assignee | ||
Comment 10•1 year ago
|
||
(In reply to Donal Meehan [:dmeehan] from comment #9)
Keith, do you want to nominate this for a release note? (Process info)
This is still flagged; so maybe better to delay and add to release notes when it's unflagged?
Comment 11•1 year ago
|
||
(In reply to Keith Cirkel from comment #10)
(In reply to Donal Meehan [:dmeehan] from comment #9)
Keith, do you want to nominate this for a release note? (Process info)
This is still flagged; so maybe better to delay and add to release notes when it's unflagged?
I saw the value in the dom.element.dialog.toggle_events.enabled pref is True, sorry for the noise if it's still gated off somehow
| Assignee | ||
Comment 12•1 year ago
|
||
Good point! Forgot about that :p. Hope this is sufficient:
Release Note Request (optional, but appreciated)
[Why is this notable]:
Firefox will now dispatch beforetoggle events just before a dialog is opening and toggle events after the dialog is closing, matching the behaviour of popovers.
[Affects Firefox for Android]:
[Suggested wording]:
Firefox will now dispatch beforetoggle events just before a dialog is opening and toggle events after the dialog is closing, matching the behaviour of popovers.
[Links (documentation, blog post, etc)]: https://bugzilla.mozilla.org/show_bug.cgi?id=1876762
Comment 13•1 year ago
|
||
Thanks, added to the Fx133 nightly release notes, please allow 30 minutes for the site to update.
Keeping the relnote-firefox flag as ? to keep it on the radar for inclusion in the final Fx133 release notes.
Comment 14•1 year ago
|
||
FF133 MDN docs for this can be tracked in https://github.com/mdn/content/issues/36536
Can you confirm the following:
- The implementation of the events is/will be the same for dialogs and popups.
beforetoggle-
is fired just before opening or closing the element.
-
when opening (only) the event is cancellable, so you could do this and stop the dialog from opening
mydialog.addEventListener('beforetoggle', (event) => { // Check if you want to cancel the toggle if (shouldCancel()) { event.preventDefault(); } }); -
when closing the event still fires but you can't prevent it closing. Presumably preventDefault is ignored.
-
Is there any other reason you might want to use beforetoggle?
-
toggleis fired just after opening or closing the element and isn't cancellable- The events are defined on
HTMLElementand inherited. <details>currently also has atoggleevent which is fired after open and close?- That's also on
HTMLElementright (I ask because MDN appears to wrongly add it toHTMLDetailsElement. - I understand you plan to add another
beforetogglefor `<details> as well. That will also be same definition in spec?
- That's also on
| Assignee | ||
Comment 15•1 year ago
|
||
All of those statements sound correct to me.
As for
Is there any other reason you might want to use beforetoggle?
Applying classes to other elements (eg body) which start animations or set properties. Or pushing URL state so that a dialogs openness is part of the URL.
Comment 16•1 year ago
|
||
Docs work for this done - just trickling through last reviews. Thank you for all your help and advice @Keith!
Comment 17•1 year ago
|
||
Added to the Fx133 release notes.
Available to preview on staging, please allow 30 minutes for the site to update.
Description
•