Conversation
…re correct CSS cascade order Agent-Logs-Url: https://github.com/IgniteUI/igniteui-angular-samples/sessions/b7433c38-919d-4392-a94a-cb4ae0dbede8 Co-authored-by: viktorkombov <75325639+viktorkombov@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix theming widget styles insertion order in head
fix: use appendChild for theme styles to win CSS cascade
Apr 9, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adjusts how the theming widget injects its generated theme <style> (and typeface <link>) so that theme styles appear last in <head> and therefore win in the CSS cascade over Angular’s global stylesheet.
Changes:
- Switch theme
<style id="igniteui-theme">insertion frominsertBefore(..., head.lastElementChild)tohead.appendChild(...). - Switch typeface
<link>insertion similarly tohead.appendChild(...). - Apply the same change across the root app and app-lob variants (including
DocsLayoutComponent).
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| src/app/app.component.ts | Appends injected theme style/typeface link to the end of <head> to improve cascade priority. |
| projects/app-lob/src/app/app.component.ts | Same injection-order fix for app-lob root component. |
| projects/app-lob/src/app/index/docs-layout.component.ts | Same injection-order fix for the docs layout component. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
fix: use appendChild for theme styles to win CSS cascade, remove duplicate theming in app-lob
fix: use appendChild for theme styles to win CSS cascade, remove duplicate theming in app-lob…ent and fix typeface link reuse
ChronosSF
approved these changes
Apr 14, 2026
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.
The theming widget's generated
<style id="igniteui-theme">was inserted before Angular's global stylesheet (always the last<head>child), causing default styles to override theme styles in the cascade. Additionally,app-lob'sDocsLayoutComponentduplicated the theming logic already owned byAppComponent, resulting in competingwindow:messagehandlers and duplicate DOM ids.createTypefaceLink()also appended a new<link>on every typeface change instead of reusing one.Changes
insertBefore(..., head.lastElementChild)withappendChildin bothcreateThemeStyle()andcreateTypefaceLink(); reuse existing<link>element by id instead of appending a new one per typeface; fix misspelled idignteui-theme-typeface→igniteui-theme-typefacengOnInit,onMessage,createThemeStyle,createTypefaceLink, and related fields);AppComponentalready owns this, aligning with the root project'sDocsLayoutComponentwhich is a bare router outlet