fix(react-provider): validate serialized theme tokens - #36713
Draft
Paul Mardling (PaulGMardling) wants to merge 3 commits into
Draft
fix(react-provider): validate serialized theme tokens#36713Paul Mardling (PaulGMardling) wants to merge 3 commits into
Paul Mardling (PaulGMardling) wants to merge 3 commits into
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
Pull request demo site: URL |
| @@ -112,6 +112,10 @@ export const customDarkTheme = createDarkTheme(customBrandRamp); | |||
|
|
|||
There was a problem hiding this comment.
🕵🏾♀️ visual changes to review in the Visual Change Report
vr-tests-react-components/Menu Converged - submenuIndicator slotted content 2 screenshots
| Image Name | Diff(in Pixels) | Image Type |
|---|---|---|
| vr-tests-react-components/Menu Converged - submenuIndicator slotted content.default - RTL.submenus open.chromium.png | 404 | Changed |
| vr-tests-react-components/Menu Converged - submenuIndicator slotted content.default.submenus open.chromium.png | 413 | Changed |
vr-tests-react-components/Positioning 2 screenshots
| Image Name | Diff(in Pixels) | Image Type |
|---|---|---|
| vr-tests-react-components/Positioning.Positioning end.updated 2 times.chromium.png | 617 | Changed |
| vr-tests-react-components/Positioning.Positioning end.chromium.png | 887 | Changed |
vr-tests-react-components/ProgressBar converged 2 screenshots
| Image Name | Diff(in Pixels) | Image Type |
|---|---|---|
| vr-tests-react-components/ProgressBar converged.Indeterminate + thickness.default.chromium.png | 54 | Changed |
| vr-tests-react-components/ProgressBar converged.Indeterminate + thickness - Dark Mode.default.chromium.png | 2 | Changed |
vr-tests-react-components/TagPicker 3 screenshots
| Image Name | Diff(in Pixels) | Image Type |
|---|---|---|
| vr-tests-react-components/TagPicker.disabled - Dark Mode.chromium.png | 658 | Changed |
| vr-tests-react-components/TagPicker.disabled - High Contrast.disabled input hover.chromium.png | 1319 | Changed |
| vr-tests-react-components/TagPicker.disabled - RTL.chromium.png | 635 | Changed |
There were 3 duplicate changes discarded. Check the build logs for more information.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
📊 Bundle size reportUnchanged fixtures
|
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Previous Behavior
createCSSRuleFromThemeserialized theme entries without verifying that each token name and value remained within one CSS custom-property declaration. A malformed entry could invalidate declarations that followed it, and the theming documentation did not describe the trust boundary for dynamic theme data.New Behavior
createCSSRuleFromThemenow accepts CSS escape-aware custom-property names and structurally contains each token value before serialization. Valid CSS syntax remains unchanged, including colors, font-family fallbacks, quoted strings, comments, nested functions, gradients, calculations, case-insensitive escaped URL forms, other escapes, and multiline whitespace. Angle-bracket canonicalization consumes backslash runs linearly while preserving CSS escape parity. Malformed lexical contexts are repaired at the token boundary so later declarations remain independently parseable; unsupported token names are omitted with a development-only warning that identifies the name without including its value.Regression coverage exercises exported themes, escaped custom-token names, compatibility syntax, long backslash runs, malformed-entry isolation, client stylesheet insertion, and server-rendered style output. The theming documentation clarifies that applications must validate dynamic data against an application-specific schema before constructing a theme.
Validation
yarn nx run react-provider:test(109 tests, 14 snapshots)yarn nx run react-provider:lintyarn nx run react-provider:type-checkyarn nx run react-provider:format:checkyarn nx run react-provider:buildyarn beachball checkRelated Issue(s)