Skip to content

fix(text-field): focused outlined rendering issues#528

Merged
kelsos merged 2 commits intorotki:mainfrom
kelsos:fix/text-field-focus-rendering
Apr 29, 2026
Merged

fix(text-field): focused outlined rendering issues#528
kelsos merged 2 commits intorotki:mainfrom
kelsos:fix/text-field-focus-rendering

Conversation

@kelsos
Copy link
Copy Markdown
Member

@kelsos kelsos commented Apr 29, 2026

Summary

Two minimal fixes for outlined RuiTextField focus-state rendering issues, both reported in #527.

  • Floated label overshoots on blur: replace percentage -translate-y-1/2 with fixed-rem -translate-y-[0.5rem] in the active+outlined compound, so the translate value doesn't depend on a label height that changes mid-transition.
  • "Two thin blue lines crossing the floated label" at fractional y-coords on non-integer DPR (1.25 in particular): add transform-gpu to the fieldset slot so the focus border is rasterized on integer pixel boundaries, eliminating Chromium's AA splitting of the 1.6–2px border.

Both bugs and fixes are described in detail in #527 (slow-mo transition trace + diagnosis for the overshoot; sub-pixel AA explanation for the line splitting). Commit messages mirror that detail.

Test plan

  • pnpm storybook → Components > Forms > TextField > Outlined: focus-blur cycle has no upward overshoot of the floated label.
  • Visual focus border on a focused outlined field is a clean single line behind the floated label (no splitting), at zoom 100% with DPR 1.25.
  • No regression in resting/floated label position, notch geometry, or border position across Default, Outlined, OutlinedWithVeryLongLabel, Required, WithErrorMessage, WithSuccessMessage stories.
  • Verified end-to-end against the rotki app's Edit Oracle Price dialog (where RuiTextField: floating label overshoots on blur due to mismatched centering strategies #527 was originally observed) by packing the library and installing as a file: dep — both symptoms gone.

kelsos added 2 commits April 29, 2026 15:06
Replace the active+outlined compound's percentage translate
(`-translate-y-1/2`) with a fixed-rem translate (`-translate-y-[0.5rem]`,
≈half the active label's natural height of `text-[0.75rem] × leading-tight`).

The percentage translate was recomputed against the *current* label
height. When `active` flips to false on blur, the class swap removes
`!h-auto` instantly so `label.height` jumps from ~15px (h-auto) to the
input's full height (~56px), and 50% of the new height (~28px) becomes
the new starting transform. The transition then animates from -28px to
0 over duration-75, producing a visible upward overshoot before easing
back. Anchoring the translate in rem keeps the start/end values
consistent across the height swap and scales with the root font-size.

Refs rotki#527
Add `transform-gpu` to the fieldset slot so the focus border is
rasterized on integer pixel boundaries.

At fractional y-coordinates with non-integer device pixel ratios (e.g.
DPR 1.25), Chromium anti-aliases the 1.6–2px focus border across two
physical pixel rows behind the floated label, appearing as "two thin
blue lines crossing the label". Promoting the fieldset to its own GPU
compositing layer snaps the layer's raster to integer pixels and
eliminates the splitting. No layout or geometry change — only forces a
layer.

Refs rotki#527
@kelsos kelsos requested a review from a team as a code owner April 29, 2026 13:08
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Apr 29, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 84.79%. Comparing base (c3b8e7c) to head (34a0ef1).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #528      +/-   ##
==========================================
- Coverage   84.80%   84.79%   -0.02%     
==========================================
  Files         145      145              
  Lines        5260     5260              
  Branches     1571     1571              
==========================================
- Hits         4461     4460       -1     
- Misses        799      800       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@kelsos kelsos merged commit 34a0ef1 into rotki:main Apr 29, 2026
5 checks passed
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