Update types to use autoFocus instead of autofocus#653
Update types to use autoFocus instead of autofocus#653aaronjensen wants to merge 2 commits intopreactjs:masterfrom
Conversation
developit
left a comment
There was a problem hiding this comment.
both work, just autoFocus sets via an attribute whereas autofocus sets via a property. autofocus is probably ideal here though, since I think this is a bit odd:
<input autoFocus={false} />
// produces
<input autoFocus="false">(I think)
|
If that's true, I think that's broken. It should produce |
|
You're styling an attribute (since properties are inaccessible from CSS), so you need to render an attribute. Perhaps it makes sense to include types for both? Technically
|
|
React apparently doesn't actually render the autofocus property regardless of how you case it. They must handle it specially, so that's a difference between react and preact, I guess. Would it make sense to patch glamorous to have it treat passed through properties in a case insensitive way? /cc @kentcdodds |
I think this makes the most sense. They really are two different things aren't they?
I'm uncertain I follow exactly what you're suggesting here. |
Sorry, I wasn't very clear. As far as I can tell, glamorous white lists attributes that are passed through to the React input element. autoFocus is one, but autofocus is not, making me wonder if the whitelist should be case insensitive. Does that make sense? |
|
Yes, that makes sense. I think that this is actually a bug in glamorous' dependency: |
|
Sure, but what would it be? It looks like it's missing |
|
Actually, |
|
@kentcdodds I've submitted that, but I'm not sure it's right. React doesn't officially support I'm not sure that I totally understand preact's stance on these attributes or why React capitalizes some of them and preact doesn't. |
|
Yeah, you're right. I think that it should be |
|
Ok, so should we add @developit is there any planned support for React's brand of autoFocus? |
|
No support planned, no - Preact will never customize or alter the behavior of DOM attributes/properties. |
Got it, thanks. So what do you think I should do here? I can just add I guess I was confused because Btw, is the attribute vs property behavior of preact documented somewhere? |
|
I wonder whether you could use That said, we really should make glamorous work out of the box with preact. Feel free to file an issue and we can look into a real solution. |
|
@aaronjensen Seems like this issue has been resolved in the preact adapter from glamorous. Is this something you'd rather see in preact core itself or should this PR be closed? |
|
works for me |
|
This has reared its head again with emotion. A |
React uses
autoFocusand that's what seems to work most reliably in preact as well, so I think this type may just be wrong.