Skip to content

Comments

Disambiguate when to add global event handlers#612

Open
domfarolino wants to merge 2 commits intow3ctag:mainfrom
domfarolino:global-event-handlers
Open

Disambiguate when to add global event handlers#612
domfarolino wants to merge 2 commits intow3ctag:mainfrom
domfarolino:global-event-handlers

Conversation

@domfarolino
Copy link

@domfarolino domfarolino commented Feb 6, 2026

Fixes #611. I think when new events are introduced with the intention of being fired at HTML or SVG elements, as opposed to just generic non-DOM-associated EventTargets, the guidance is to add them to the GlobalEventHandlers mixin.

As #611 notes, this is the advice I received by Domenic in WICG/fenced-frame#144 (comment), and I think there is slightly ambiguous wording in the design principles that may mistakenly lead people away from this advice when designing new APIs that introduce new events aimed at HTML elements. See #611 (comment).


Preview | Diff

@domfarolino
Copy link
Author

@zcorpan @annevk Can you confirm that this is right? In particular, #611 (comment).

Copy link
Member

@annevk annevk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure that we necessarily want all SVG events to end up on that list, but maybe? The other direction does seem like it's usually desired.

cc @foolip

@marcoscaceres marcoscaceres self-requested a review February 10, 2026 04:18
Co-authored-by: Jeffrey Yasskin <jyasskin@gmail.com>
@domfarolino
Copy link
Author

That suggestion works for me @jyasskin, thanks! Btw @annevk, can you think of any specific guidance we could add (maybe in a follow-up) for when it would make sense to add element-specific handlers, instead of adding global ones?

@annevk
Copy link
Member

annevk commented Feb 11, 2026

Element-specific seems almost never justified (due to bubbling), but I don't know how many events SVG and MathML define and whether we want to have those on the global list.

@marcoscaceres
Copy link
Contributor

I think @bkardell said none for MathML. I’m unsure about svg. Maybe we should take out mentions of those.

@marcoscaceres
Copy link
Contributor

Checked SVG’s IDL. It depends fully on html. https://www.w3.org/TR/SVG2/idl.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Clarify guidance for onfoo attributes

4 participants