Skip to content
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

Wrong typing for HTML translate property #4464

Closed
teodragovic opened this issue Jul 31, 2024 · 3 comments
Closed

Wrong typing for HTML translate property #4464

teodragovic opened this issue Jul 31, 2024 · 3 comments

Comments

@teodragovic
Copy link
Contributor

Describe the bug

[Per spec], translate property value is defined as empty string, "yes" or "no" but Preact expects boolean which produces TS error.

To Reproduce

Add translate="no" or translate="yes" to any HTML element in Preact app.

@rschristian
Copy link
Member

rschristian commented Jul 31, 2024

(Just to copy what I wrote on the PR...)

The translate attribute is an empty string, "yes", or "no": MDN
The translate property is a boolean: MDN

Personally, I'd prefer to support both given JSX is already an arbitrary mix of attributes & properties, but this isn't just a types change and has some real world cost, so we'll have to stick to the property.

@teodragovic
Copy link
Contributor Author

Ah, well that was confusing lol. Ok, I'll close PR and ticket. Thanks for the clarification @rschristian

@rschristian
Copy link
Member

It's especially fun when you set htmlElement.translate = "no" and it becomes "yes"/true :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants