GitHub user dosubot[bot] added a comment to the discussion: Upgrading from 
version 5 to 6 has broken CSS updates

<!-- Answer -->
There isn’t a built-in way in Superset to add custom CSS just once and have it 
survive all future upgrades without ever needing to update selectors. 
Superset’s frontend uses dynamically generated class names (via Emotion and Ant 
Design), and major upgrades often change the DOM and class structure, which 
breaks CSS that targets those classes or elements. Even if you use persistent 
CSS templates or the dashboard CSS editor, you’ll still need to adapt your 
selectors after upgrades that change the DOM or class names 
[(source)](https://github.com/apache/superset/issues/32847).

To minimize breakage, use the most stable selectors available—like chart IDs, 
`data-test` attributes, or general container classes (e.g., 
`.dashboard-content`, `.grid-container`)—and avoid targeting generated class 
names [(source)](https://github.com/apache/superset/issues/36794). Superset is 
working toward more robust, token-based theming, but for now, updating 
selectors after major upgrades is unavoidable 
[(source)](https://github.com/apache/superset/issues/36842).

Best practice: document your customizations, use CSS templates for persistence, 
and plan to review selectors after each major upgrade.


<!-- Dosu Comment Footer -->
*To reply, just mention [@dosu](https://go.dosu.dev/dosubot).*

---
<sup>How did I do? 
[Good](https://app.dosu.dev/response-feedback/241a5789-1c5e-4da2-bc20-98962e256681?feedback_type=great_response)
 | 
[Irrelevant](https://app.dosu.dev/response-feedback/241a5789-1c5e-4da2-bc20-98962e256681?feedback_type=irrelevant_answer)
 | 
[Incorrect](https://app.dosu.dev/response-feedback/241a5789-1c5e-4da2-bc20-98962e256681?feedback_type=incorrect_sources)
 | 
[Verbose](https://app.dosu.dev/response-feedback/241a5789-1c5e-4da2-bc20-98962e256681?feedback_type=too_verbose)
 | 
[Hallucination](https://app.dosu.dev/response-feedback/241a5789-1c5e-4da2-bc20-98962e256681?feedback_type=hallucination)
 | [Report 
🐛](https://app.dosu.dev/response-feedback/241a5789-1c5e-4da2-bc20-98962e256681?feedback_type=bug_report)
 | 
[Other](https://app.dosu.dev/response-feedback/241a5789-1c5e-4da2-bc20-98962e256681?feedback_type=other)</sup>

[![Chat with 
Dosu](https://dosu.dev/dosu-chat-badge.svg)](https://app.dosu.dev/a28d3c7e-a9d3-459e-9fb6-3a6f9ff4f357/ask?utm_source=github)&nbsp;[![Open
 in 
Cursor](https://dosu.dev/dosu-in-cursor.svg)](https://cursor.com/link/prompt?text=There%20isn%E2%80%99t%20a%20built-in%20way%20in%20Superset%20to%20add%20custom%20CSS%20just%20once%20and%20have%20it%20survive%20all%20future%20upgrades%20without%20ever%20needing%20to%20update%20selectors.%20Superset%E2%80%99s%20frontend%20uses%20dynamically%20generated%20class%20names%20%28via%20Emotion%20and%20Ant%20Design%29%2C%20and%20major%20upgrades%20often%20change%20the%20DOM%20and%20class%20structure%2C%20which%20breaks%20CSS%20that%20targets%20those%20classes%20or%20elements.%20Even%20if%20you%20use%20persistent%20CSS%20templates%20or%20the%20dashboard%20CSS%20editor%2C%20you%E2%80%99ll%20still%20need%20to%20adapt%20your%20selectors%20after%20upgrades%20that%20change%20the%20DOM%20or%20class%20names%20%5B%28source%29%5D%28https%3A//github.c
 
om/apache/superset/issues/32847%29.%0A%0ATo%20minimize%20breakage%2C%20use%20the%20most%20stable%20selectors%20available%E2%80%94like%20chart%20IDs%2C%20%60data-test%60%20attributes%2C%20or%20general%20container%20classes%20%28e.g.%2C%20%60.dashboard-content%60%2C%20%60.grid-container%60%29%E2%80%94and%20avoid%20targeting%20generated%20class%20names%20%5B%28source%29%5D%28https%3A//github.com/apache/superset/issues/36794%29.%20Superset%20is%20working%20toward%20more%20robust%2C%20token-based%20theming%2C%20but%20for%20now%2C%20updating%20selectors%20after%20major%20upgrades%20is%20unavoidable%20%5B%28source%29%5D%28https%3A//github.com/apache/superset/issues/36842%29.%0A%0ABest%20practice%3A%20document%20your%20customizations%2C%20use%20CSS%20templates%20for%20persistence%2C%20and%20plan%20to%20review%20selectors%20after%20each%20major%20upgrade.)&nbsp;[![Join
 
Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbs
 p;[![Share on 
X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/apache/superset/discussions/37504)

GitHub link: 
https://github.com/apache/superset/discussions/37504#discussioncomment-15624182

----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: 
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to