-
Notifications
You must be signed in to change notification settings - Fork 4k
[fix] Ensure crossOrigin attribute is properly set for CCv2 stylesheets #13376
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] Ensure crossOrigin attribute is properly set for CCv2 stylesheets #13376
Conversation
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
✅ PR preview is ready!
|
This stack of pull requests is managed by Graphite. Learn more about stacking. |
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 PR fixes the crossOrigin attribute handling for CCv2 (Custom Component v2) stylesheet links to ensure consistent CORS behavior across the application. The change ensures that stylesheet <link> elements receive the same cross-origin treatment as other media resources.
Key changes:
- Integrates
useCrossOriginAttributehook to compute the appropriatecrossOriginattribute value for CSS links - Sets the
crossOriginattribute on dynamically created<link>elements when loading external stylesheets - Adds comprehensive test coverage for different cross-origin scenarios (anonymous, use-credentials, and external URLs)
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
frontend/lib/src/components/widgets/BidiComponent/hooks/useHandleHtmlAndCssContent.ts |
Integrates useCrossOriginAttribute hook and conditionally sets crossOrigin attribute on stylesheet link elements based on URL origin |
frontend/lib/src/components/widgets/BidiComponent/BidiComponent.test.tsx |
Adds mock configuration setup and parameterized tests verifying correct crossOrigin attribute behavior for different scenarios |
frontend/lib/src/components/widgets/BidiComponent/BidiComponent.test.tsx
Outdated
Show resolved
Hide resolved
frontend/lib/src/components/widgets/BidiComponent/BidiComponent.test.tsx
Outdated
Show resolved
Hide resolved
frontend/lib/src/components/widgets/BidiComponent/BidiComponent.test.tsx
Outdated
Show resolved
Hide resolved
9b094cb to
372fba5
Compare
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
Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.
|
@cursor review |
lukasmasuch
left a comment
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.
LGTM 👍
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.
✅ Bugbot reviewed your changes and found no bugs!
…ts (#13376) ## Describe your changes Added support for the `crossOrigin` attribute on CSS link elements to CCv2 instances. This ensures that CSS resources loaded from different origins follow the same cross-origin policy as other resources in the application. The implementation: 1. Uses the existing `useCrossOriginAttribute` hook to determine the appropriate crossOrigin value 2. Applies the crossOrigin attribute to link elements when loading CSS from relative paths 3. Maintains consistent behavior with other media elements in the application ## Testing Plan - Adds unit tests --- **Contribution License Agreement** By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license.

Describe your changes
Added support for the
crossOriginattribute on CSS link elements to CCv2 instances. This ensures that CSS resources loaded from different origins follow the same cross-origin policy as other resources in the application. The implementation:useCrossOriginAttributehook to determine the appropriate crossOrigin valueTesting Plan
Contribution License Agreement
By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license.