-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Update Components List Styles (#8254) #8317
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
Update Components List Styles (#8254) #8317
Conversation
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.
Pull request overview
This pull request updates the ComponentList application to support dynamic framework-specific styling based on the user's framework preference stored in localStorage. The changes enable the component list page to display framework-appropriate link colors and theme-aware background colors.
- Adds JavaScript to dynamically apply framework class to body element
- Introduces CSS rules for theme-aware background colors using light-dark() function
- Defines framework-specific link colors for jQuery, Angular, Vue, and React
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| applications/ComponentList/index.js | Adds framework class from localStorage to body element for dynamic styling |
| applications/ComponentList/index.css | Adds base body styles with light-dark theme support and framework-specific link color rules |
| @@ -0,0 +1 @@ | |||
| document.body.classList.add(localStorage.getItem('dx-devextreme-site-framework')); | |||
Copilot
AI
Jan 7, 2026
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.
The code directly adds the value from localStorage to classList without any validation or null checking. If the localStorage key does not exist, getItem returns null, which could cause classList.add to add the string "null" as a class name. Consider adding a guard to check if the value exists before adding it to the classList.
| document.body.classList.add(localStorage.getItem('dx-devextreme-site-framework')); | |
| const frameworkClass = localStorage.getItem('dx-devextreme-site-framework'); | |
| if (frameworkClass) { | |
| document.body.classList.add(frameworkClass); | |
| } |
| @@ -0,0 +1 @@ | |||
| document.body.classList.add(localStorage.getItem('dx-devextreme-site-framework')); | |||
Copilot
AI
Jan 7, 2026
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.
The code adds an untrusted value from localStorage directly to the classList without sanitization. While the CSS only defines specific framework classes (jQuery, Angular, Vue, React), a malicious value could inject arbitrary class names. Consider validating the value against an allowlist of expected framework names before adding it to classList.
| document.body.classList.add(localStorage.getItem('dx-devextreme-site-framework')); | |
| var framework = localStorage.getItem('dx-devextreme-site-framework'); | |
| var allowedFrameworks = ['jquery', 'angular', 'vue', 'react']; | |
| if (framework && allowedFrameworks.indexOf(framework) !== -1) { | |
| document.body.classList.add(framework); | |
| } |
No description provided.