[fix] Ensure crossOrigin attribute is properly set for CCv2 stylesheets#13376
Merged
sfc-gh-bnisco merged 1 commit intodevelopfrom Dec 16, 2025
Conversation
Contributor
✅ 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. |
Contributor
✅ PR preview is ready!
|
Collaborator
Author
This stack of pull requests is managed by Graphite. Learn more about stacking. |
Contributor
There was a problem hiding this comment.
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
Collaborator
|
@cursor review |
github-actions bot
pushed a commit
that referenced
this pull request
Dec 16, 2025
…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.
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.

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.