Skip to main content
GoodFirstPicks
DashboardIssuesReposLeaderboard

GoodFirstPicks by Leaveitblank © 2026

CreatorRequest a RepoPrivacy PolicyTerms of Service
Fit Text does not scale correctly inside Media & Text block in Firefox | GoodFirstPicks

Fit Text does not scale correctly inside Media & Text block in Firefox

WordPress/gutenberg 1 comments 12d ago
View on GitHub
mediumopenScope: somewhat clearSkill match: maybeTest focusedWordPressJavaScriptReact

Why this is a good first issue

Firefox-specific rendering issue with fitText in CSS Grid contexts requires browser-specific debugging.

AI Summary

The issue involves Firefox incorrectly calculating text scaling within CSS Grid layouts in the Media & Text block. While the problem is isolated to Firefox and has clear reproduction steps, the solution may require understanding both the fitText algorithm and Firefox's grid implementation quirks. The previous flex container fix (#73652) suggests this might be a similar but distinct grid-related issue.

Issue Description

Description

When "Fit text" is enabled (Typography > Fit text toggle) on a Paragraph or Heading block placed inside a Media & Text block, the text does not scale correctly in Firefox. It renders correctly in Chrome, Edge, Brave, and Safari.

The text either overflows the content area or renders at a size that doesn't fit the container — on both frontend and backend (editor).

This appears to be the CSS Grid counterpart of the flex container issue fixed in #73652. That PR fixed fitText inside flex containers, but the Media & Text block uses a CSS Grid layout (grid-template-columns: 50% 1fr), and the same class of problem occurs here — the fitText algorithm miscalculates the available width inside the 1fr grid column in Firefox.

I also attempted the CSS-only fix of adding min-width: 0 to .wp-block-media-text__content (which is a standard fix for grid item intrinsic sizing in Firefox), but this did not resolve the issue. The problem appears to be in how the fitText JavaScript reads the container dimensions inside a CSS Grid context in Firefox, not just in how Firefox resolves min-width: auto.

Step-by-step reproduction instructions

  1. Open Firefox (tested with v147.0.4 and Developer Edition v148.0b15)
  2. Create a new post
  3. Add a Media & Text block
  4. Add an image to the media side
  5. In the text content area, add a Paragraph or Heading block
  6. Enable "Fit text" under Typography settings for that block
  7. Observe: the text does not scale to fit the content area properly

Now open the same page in Chrome — the text scales correctly.

Expected behavior

The text should scale to fit the available width of the .wp-block-media-text__content area, just like it does in Chrome/Edge/Safari.

Actual behavior

In Firefox, the text either overflows the content column or renders at an incorrect (too large) size. Problem occurs on both the frontend and within the block editor.

Environment info

  • Word

GitHub Labels

[Status] In ProgressBrowser Issues[Block] Media & Text[Block] Stretchy Text

Want to work on this?

Claim this issue to let others know you're working on it. You'll earn 20 points when you complete it!

Risk Flags

  • Firefox-specific behavior
  • CSS Grid layout interactions
Loading labels...

Details

Points20 pts
Difficultymedium
Scopesomewhat clear
Skill Matchmaybe
Test Focusedyes
AssigneeMustafabharmal