Skip to content

[FEATURE] Recognize newer CSS units in Size - #1641

Merged
JakeQZ merged 1 commit into
MyIntervals:mainfrom
felipemarcos:bugfix/missing-css-units
Oct 3, 2026
Merged

JakeQZ merged 1 commit into
MyIntervals:mainfrom
felipemarcos:bugfix/missing-css-units

Conversation

@felipemarcos

Copy link
Copy Markdown
Contributor

Size::parse() only knows the units in its hardcoded lists, so values like 2cqi were split into 2 and cqi. This rendered as invalid CSS, and in lenient mode it dropped whole declarations that used these units inside calc()/min().

This adds the missing units:

  • container query: cqw, cqh, cqi, cqb, cqmin, cqmax
  • viewport: dv*, lv*, sv* variants, vi, vb
  • font-relative: cap, ic, lh, rlh, rex, rch, rcap, ric
  • non-size units: dpi, dpcm, dppx, x

Add the container query, dynamic/large/small/logical viewport,
font-relative and resolution units to the known units. Before, a
value like `2cqi` was split into the number and a separate
identifier, which rendered as invalid CSS and could drop whole
declarations using these units inside functions in lenient mode.
@coveralls

Copy link
Copy Markdown

Coverage Status

coverage: 74.621%. remained the same — felipemarcos:bugfix/missing-css-units into MyIntervals:main

@JakeQZ JakeQZ left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks @felipemarcos, this looks excellent to me and good to merge.

For reference, the current list of units is at https://developer.mozilla.org/en-US/docs/Web/CSS/Guides/Values_and_units#units.

I think this is more feature than bugfix - it wasn't a bug until the new units were introduced, though I note that #1639 is also listed in the 'fixed' category. I'll create a separate PR to adjust the changelog (and add the PR number for this).

Longer term, it would be good to find a way of not having to keep updating the list of units... :)

@oliverklee, let us know if you spot anything amiss that we've missed.

@JakeQZ
JakeQZ merged commit 31f1999 into MyIntervals:main Oct 3, 2026
50 of 51 checks passed
JakeQZ added a commit that referenced this pull request Oct 3, 2026
JakeQZ added a commit that referenced this pull request Oct 3, 2026
These aren't bugfixes; they are supporting new CSS features.

Also add reference in entry for #1641.
oliverklee pushed a commit that referenced this pull request Oct 4, 2026
These aren't bugfixes; they are supporting new CSS features.

Also add reference in entry for #1641.
@oliverklee oliverklee added the bug label Oct 4, 2026
@oliverklee oliverklee added enhancement and removed bug labels Oct 4, 2026
@oliverklee oliverklee changed the title [BUGFIX] Recognize newer CSS units in Size [FEATURE] Recognize newer CSS units in Size Oct 4, 2026
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.

4 participants