-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
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
feat: Add onBeforeToggle event handler type #4694
Conversation
d60366b
to
c33c424
Compare
@@ -625,7 +625,8 @@ export namespace JSXInternal { | |||
onCompositionUpdate?: CompositionEventHandler<Target> | undefined; | |||
onCompositionUpdateCapture?: CompositionEventHandler<Target> | undefined; | |||
|
|||
// Details Events | |||
// Popover Events | |||
onBeforeToggle?: ToggleEventHandler<Target> | undefined; | |||
onToggle?: ToggleEventHandler<Target> | undefined; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DetailsHTMLAttributes has an onToggle defined too, but as a GenericEventHandler idk if that should be removed or if it is in addition to this type (can't really remember how TS works).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That'd be a mistake -- IIRC, the DetailsHTMLAttributes
interface was created prior, then moved into this module. Later we added this entry with a backport of the correct event handler type. I think the DetailsHTML
interface will take precedence too so that should probably be removed in favor of this "global" type, but that can be done separately later.
I think in the future we'll try to break up this mega list of events too, try to restrict them (where appropriate) to specific elements.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cheers
This is slightly complicated, basically Details has had an ontoggle for a long time but historically it was just an Event. More recently Popovers were added and they had a beforetoggle and a toggle event but used a new ToggleEvent type. Details was subsequently updated to use this type for it's toggle event too (but it doesn't have a beforetoggle event itself).
Dialogs also more recently have had a toggle and beforetoggle event added to them.