S
SolidJS•2y ago
phungleson

onfocus or onFocus or onFocusIn?

It is probably not solid issue, but not sure which one to use. I upgraded latest solid-js and onFocus seems to be gone, not sure if it was even there before? I tried to use onFocusIn but it seem to work with playwright but not vitest i.e. fireEvent.focus? I tried to use onfocus and it works well but it seems like generic html even handler, which is a bit out of place in middle of JSX. I wonder how everyone handle this case?
17 Replies
mdynnl
mdynnl•2y ago
focusin|out is delegated, focus is not and event names in on__ event handlers are case-insensitive (lowercased eventually) delegated or not
phungleson
phungleson•2y ago
Thanks, I am not sure what is the norm, camelCase or lowercase? I has been using camel case for quite a while (I mean solid JSX used to have onFocus and it worked well) maybe I should convert everything to lowercase moving forward?
mdynnl
mdynnl•2y ago
i meant that they are transformed into lower case eventually by the compiler
phungleson
phungleson•2y ago
Yeah I understand, sorry my question should probably be phrased as why onFocus is removed? (if I am not wrong)
mdynnl
mdynnl•2y ago
i think solid tries to align with dom conventions, ele.onclick = () => {} but also provide onClick from other frameworks' conventions, as far as the types are concerned
phungleson
phungleson•2y ago
Yeah I understand Ryan's intention here, it used to have onFocus, now it doesn't, so I am not sure if it is removed by mistake or something else
mdynnl
mdynnl•2y ago
oh, you meant jsx types?
phungleson
phungleson•2y ago
Yes
mdynnl
mdynnl•2y ago
i was only talking about compiler and runtime
phungleson
phungleson•2y ago
Apologies as my question wasn't too clear
mdynnl
mdynnl•2y ago
i see, then maybe a change to differentiate delegated vs non
phungleson
phungleson•2y ago
It still has onfocusin though Maybe we should ask Ryan? I quickly looked through the commits but didn't see anything suspicious
mdynnl
mdynnl•2y ago
the types come from ryansolid/dom-expressions this happens to most of us 😆 it should be probably moved to solid-js in the future
phungleson
phungleson•2y ago
GitHub
Reorganize jsx-runtime html/svg type definitions (#191) · ryansoli...
* reorganize jsx-runtime html/svg type definitions add jsdoc-like references to where each element comes from add support template html field add verify_types.ts file to add extra static check...
phungleson
phungleson•2y ago
Reorganize is a dangerous word 🥲 Thanks! @mdynnl 😃
phungleson
phungleson•2y ago
Ah interesting, thanks, I wonder why my vscode doesn't pick up 🤔 I am on solidjs 1.6.11
Want results from more Discord servers?
Add your server
More Posts