[all components] Only define preventBaseUIHandler on event handlers typing that actually contain it#4089
[all components] Only define preventBaseUIHandler on event handlers typing that actually contain it#4089flaviendelangle wants to merge 2 commits intomui:masterfrom
preventBaseUIHandler on event handlers typing that actually contain it#4089Conversation
commit: |
Bundle size report
Check out the code infra dashboard for more information about this PR. |
I think this would make more sense. It'd signals wether an event handler can be prevented (i.e. does something on the Base UI side) or not. |
✅ Deploy Preview for base-ui ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
edac27f to
490e263
Compare
preventBaseUIHandler on event handlers typing that actually contain it
preventBaseUIHandler on event handlers typing that actually contain itpreventBaseUIHandler on event handlers typing that actually contain it
|
I'm exploring hardcoding the preventable events on a few components to see what it would mean in practice. |
92aff11 to
3737c79
Compare
|
I migrated a few components, but this feels super fragile. |
3737c79 to
0314ef2
Compare
|
Seems like this issue exists because only our internal props are marked with It seems like if both sets of props are marked, then this issue would be fixed without needing to split types or define every handler upfront It probably does have a non insignificant runtime cost in some cases though, in which case the type-level fix is better |
That's another approach indeed, way better than marking all the event handlers that could potentially exist 😆 I think we can discuss it on today's meeting 👍 |

Fixes #4088
I added support for
event.preventBaseUIHandler()but we could also consider removing it from the types when it was not supported 👍