Skip to content

fix(tech-radar): import Typography from its public entry point - #11580

Open
jozsefurak-seon wants to merge 2 commits into
backstage:mainfrom
jozsefurak-seon:fix/tech-radar-typography-import
Open

jozsefurak-seon wants to merge 2 commits into
backstage:mainfrom
jozsefurak-seon:fix/tech-radar-typography-import

Conversation

@jozsefurak-seon

Copy link
Copy Markdown

Hey, I just made a Pull Request!

RadarLegendRing imports Typography from @material-ui/core/Typography/Typography. That path resolves to the CommonJS file of the component, so the app bundles a second copy of Typography next to the one every other package gets from @material-ui/core/Typography (the ESM build). Material UI v4 only supports first and second level imports and warns that deeper ones can duplicate modules.

The second copy loads only with the radar, so its stylesheet is injected after the app's styles. While the radar is shown, its .MuiTypography-root rules win over every class that restyles Typography, also outside the plugin:

 <head>
   <style data-meta="MuiTypography">   shared Typography (ESM)
   <style data-meta="makeStyles">      app styles, e.g. the sidebar logo margin-left: 24px
+  <style data-meta="MuiTypography">   second Typography (CommonJS), added with the radar: margin: 0 wins

In our app this moved the sidebar logo left (1) and made the sidebar labels medium instead of bold (2) on the radar tabs. Both came back on a tab without the radar, so switching tabs made the sidebar jump. The sidebar is the stock one from @backstage/core-components.

Before

Radar tab: sidebar logo cut off at the left edge, sidebar labels medium

After

Radar tab: sidebar logo in place, sidebar labels bold

  1. Sidebar logo: loses its left margin and is cut off.
  2. Sidebar labels: lose their bold font weight.

The ClassNameMap imports from @material-ui/core/styles/withStyles are type-only and removed at build time, so I left them.

✔️ Checklist

  • A changeset describing the change and affected packages. (more info)
  • Added or updated documentation (not needed)
  • Tests for new functionality and regression tests for bug fixes (Jest resolves both paths to the same CommonJS file, so a unit test can't show the duplicate)
  • Screenshots attached (for UI changes)
  • All your commits have a Signed-off-by line in the message. (more info)

RadarLegendRing imported @material-ui/core/Typography/Typography, which resolves to the CommonJS build and loads a second copy of Typography. Its stylesheet is injected after the app's styles, so while the radar is shown it overrides every class that restyles Typography (for example the sidebar's).

Signed-off-by: jozsefurak-seon <[email protected]>
@backstage-goalie

Copy link
Copy Markdown
Contributor

Changed Packages

Package Name Package Path Changeset Bump Current Version
@backstage-community/plugin-tech-radar workspaces/tech-radar/plugins/tech-radar patch v1.23.0

@jozsefurak-seon
jozsefurak-seon marked this pull request as ready for review October 12, 2026 16:12
@jozsefurak-seon
jozsefurak-seon requested a review from a team as a code owner October 12, 2026 16:12

@vinzscam vinzscam left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you 🙏

Co-authored-by: Vincenzo Scamporlino <[email protected]>
Signed-off-by: József Urak <[email protected]>
@github-actions

Copy link
Copy Markdown
Contributor

This PR has been automatically marked as stale because it has not had recent activity from the author. It will be closed if no further activity occurs. If the PR was closed and you want it re-opened, let us know and we'll re-open the PR so that you can continue the contribution!

@github-actions github-actions Bot added the stale label Nov 24, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants