Skip to content

Fix inline vertical-align top and bottom alignment - #1613

Open
YOSEFTT wants to merge 3 commits into
daohoangson:masterfrom
YOSEFTT:Repair
Open

Fix inline vertical-align top and bottom alignment#1613
YOSEFTT wants to merge 3 commits into
daohoangson:masterfrom
YOSEFTT:Repair

Conversation

@YOSEFTT

@YOSEFTT YOSEFTT commented Aug 11, 2026

Copy link
Copy Markdown

Fix inline vertical-align top and bottom alignment

Summary

Fixes reversed placeholder alignment for inline vertical-align: top and
vertical-align: bottom.

The previous placeholder mapping made top and bottom render in the opposite
positions. sub and super still appeared correct because their padded wrapper
adds a second alignment adjustment, so the two effects canceled each other out.
Plain top and bottom do not use that wrapper, which exposed the reversed
mapping.

Changes

  • Map vertical-align: top to PlaceholderAlignment.bottom.
  • Map vertical-align: bottom to PlaceholderAlignment.top.
  • Keep the existing sub and super placeholder mappings so their padded
    alignment behavior stays unchanged.
  • Update regression expectations for inline text, styled text, inline elements,
    inline-block elements, and images.

Verification

  • git diff --check
  • flutter test test/style_vertical_align_test.dart from packages/core
    • 00:53 +26: All tests passed!

Note: this is a Flutter widget test, so the supported verification command is
flutter test. A direct dart test invocation is not appropriate here; it
loads the test on the plain Dart VM and fails because Flutter's dart:ui
library is unavailable there.

@YOSEFTT

YOSEFTT commented Aug 20, 2026

Copy link
Copy Markdown
Author

verified in a production Flutter app,
This is the code I wrote in the file:

Normal text <span style="vertical-align:super;">Raised to full height</span> Normal text <span style="vertical-align:sub;">lowered to full height</span> <span style="vertical-align:top;">Relegated to the bottom of the line</span> Normal text <span style="vertical-align:bottom;">Raised to the top of the line</span>

This is how it actually looks in the app:

image

If you want, I can also add a test that measures real position in the papillae to prove it objectively.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants