fix(text): activate verticalAlign on maxHeight alone#28
Merged
Conversation
verticalAlign was silently ignored unless `contain` included height — so setting `verticalAlign: 'middle'` on a node with only `maxHeight` did nothing. Split the gating: verticalAlign now activates whenever maxHeight > 0, while the mountY-against-maxHeight override stays tied to `contain & height` (preserving existing mount semantics). Also fix the stale `Not yet implemented in the SDF renderer` docstring on the verticalAlign prop — CoreTextNode handles both backends — and correct the documented default (Stage.ts resolves to 'top'). Adds a 3-line row to the visual regression matrix to cover first/last-line asymmetry. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Summary
verticalAlignwas silently ignored unlesscontainincluded height. SettingverticalAlign: 'middle'on a node with onlymaxHeightdid nothing. This splits the gating soverticalAlignactivates whenevermaxHeight > 0, while themountY-against-maxHeightoverride stays tied tocontain & height(preserves existing mount semantics).verticalAlignprop —CoreTextNodealready drives the offset for both backends — and corrects the documented@default(Stage.ts resolves missing values to'top', not'middle').top/middle/bottom.Decisions
'top'semantics: kept as CSS line-box (current behavior — half-leading above the first cap-top). No new'top-tight'enum.'bottom'semantics: kept as CSS — half-leading slack below the last descender.'baseline': explicitly considered and skipped (no obvious meaning in a block-vs-maxHeightcontext).maxHeight > 0alone. This is the only behavior change.Test plan
pnpm buildclean.vitest run— 168/168 pass.text-vertical-align-{1,2}.pngchanged; all other text/scaling/contain snapshots produce identical bytes because the default is unchanged).top/middle/bottom×sdf/canvasmatches expectations (cap-anchored baselines land on the green reference lines).🤖 Generated with Claude Code