-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
fix: set strings as attributes, non-strings as properties if property exists #13327
Conversation
🦋 Changeset detectedLatest commit: 05b3542 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
@@ -147,6 +147,19 @@ export function head(payload, fn) { | |||
head_payload.out += BLOCK_CLOSE; | |||
} | |||
|
|||
/** | |||
* `<div translate={false}>` should be rendered as `<div translate="no">` and _not_ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how on gods green earth did we get here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
uSe THe PlaTfOrM
Alternative to #12734. Closes #12664. This feels like a more principled approach to the problem: if something is a non-string and exists as a property on the element, set it as a property, otherwise set it as an attribute.
This allows us to handle some of the platform's oddities gracefully, without needing to ship a lookup to the browser: if a component contains
<div translate="no">
, then we disable translation on that element (withdiv.setAttribute('translate', 'no')
). If it containstranslate={false}
, we achieve the same outcome withdiv.translate = false
.Draft because I just realised that we still need a lookup for SSRBefore submitting the PR, please make sure you do the following
feat:
,fix:
,chore:
, ordocs:
.Tests and linting
pnpm test
and lint the project withpnpm lint