Comments (5)
Are you saying that JSX should be using all lowercase instead, and the definitions in jsx.d.ts don't really matter?
No, I was just giving historical context. We should support lowercased events like they are specced in web standards + camelCase. Might just be a matter of updating the type definitions in our JSX types.
from preact.
FYI: Preact supports all lowercase event name to align with the web. I think the Capture
suffix is because of a check in our source for capture events that's case sensitive. Might make sense to loosen that restriction. Off the top of my head I'm not sure if we support camelcasing them all natively or only in compat. Something worth to check.
from preact.
@marvinhagemeister VSCode gives me an uncomfortable error if the JSX attribute doesn't match exactly. For example:
Type '{ children: Element[]; id: string; class: string; onFocusin: undefined; }' is not assignable to type 'HTMLAttributes'.
Property 'onFocusin' does not exist on type 'HTMLAttributes'. Did you mean 'onfocusin'? ts(2322)
from preact.
Yeah onFocusin
is something we'll never support. In your original message you wrote onFocusIn
(note the uppercase letter I). Where is this new form of casing coming from?
from preact.
In my original message, I suggested that the definitions for these event attributes are incorrectly cased compared to the rest of the event attributes (scan the entire list in the file I cited - every single one of them is camel cased except for four of the focus events). I suggested alternatives that would bring them into consistency.
I think I may have been unclear after that - I'm not saying that I want to use onFocusin
. I want to use camel cased attributes as they are defined in jsx.d.ts. Are you saying that JSX should be using all lowercase instead, and the definitions in jsx.d.ts don't really matter?
from preact.
Related Issues (20)
- Components keep being added when updating state HOT 1
- Add JSX TS aria roles for dpub-aria-1.0
- `TypeError: Cannot set properties of null (setting '__m')` with preact 10.19.4 when destroying a component that calls `useId`
- Problem with rendering child component on props changes HOT 3
- "Components keep being added when updating state" issue persists when using tags other than div HOT 1
- preact/compat's SetStateAction is different from React's SetStateAction HOT 4
- useSelector hook stops being called under certain conditions since preact 10.19.4 HOT 3
- Implement onscrollend event attribute for TypeScript JSX
- Typescript issues in 10.19.4+ with @mui/material HOT 5
- Provide a boundary between Components and DOM HOT 8
- `preact` `10.9.4+` requires double click or move pointer out of `@headlessui/react` `Tab` panel/button HOT 2
- Unmount hooks should be called during the commit phase to ensure consistency with React HOT 2
- When I attempt to extend HTMLAttributes every intrinsic element becomes of type any HOT 2
- Current plan for event types? HOT 3
- onFocusIn and onFocusOut events incorrectly set HOT 4
- Cannot read properties of undefined (reading '__m')
- `hydrate` doesn't replace attributes at root replaced node HOT 4
- Unable to use hooks in compiled package
- Compatibility issue: Jest mock works in React / fails in Preact when using ForwardRef in a component HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from preact.