Skip to content

fix(@angular-devkit/build-angular): handle load event for multiple stylesheets and CSP nonces #26941

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

Merged
merged 2 commits into from
Jan 24, 2024

Conversation

alan-agius4
Copy link
Collaborator

The load event for each stylesheet may not always be triggered by Google Chrome's handling. Refer to: https://crbug.com/1521256

This results in the media attribute persistently being set to print, leading to distorted styles in the UI. To address this issue, we substitute the onload logic by replacing link.addEventListener('load', ... with document.documentElement.addEventListener('load', ... and filtering for link tags.

Closes #26932

@alan-agius4 alan-agius4 added action: review The PR is still awaiting reviews from at least one requested reviewer target: patch This PR is targeted for the next patch release labels Jan 24, 2024
@alan-agius4 alan-agius4 requested a review from crisbeto January 24, 2024 12:25
…iple stylesheets and CSP nonces

The `load` event for each stylesheet may not always be triggered by Google Chrome's handling. Refer to: https://crbug.com/1521256

This results in the media attribute persistently being set to print, leading to distorted styles in the UI. To address this issue, we substitute the onload logic by replacing `link.addEventListener('load', ...` with `document.documentElement.addEventListener('load', ...` and filtering for link tags.

Closes angular#26932
…and CSP nonces

The `load` event for each stylesheet may not always be triggered by Google Chrome's handling. Refer to: https://crbug.com/1521256

This results in the media attribute persistently being set to print, leading to distorted styles in the UI. To address this issue, we substitute the onload logic by replacing `link.addEventListener('load', ...` with `document.documentElement.addEventListener('load', ...` and filtering for link tags.

Closes angular#26932
@alan-agius4 alan-agius4 added action: merge The PR is ready for merge by the caretaker and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Jan 24, 2024
@alan-agius4 alan-agius4 merged commit eef1aa8 into angular:main Jan 24, 2024
@alan-agius4 alan-agius4 deleted the csp-media-attr-load branch January 24, 2024 13:58
@alan-agius4 alan-agius4 changed the title fix(@angular-devkit/build-angular): handle handle load event for multiple stylesheets and CSP nonces fix(@angular-devkit/build-angular): handle load event for multiple stylesheets and CSP nonces Jan 24, 2024
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Feb 24, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker target: patch This PR is targeted for the next patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Angular does not always load CSS bundles properly on sites with multiple stylesheets and CSP nonces enabled
2 participants