Skip to content

fix: align inline suggestion with vertically centered input text#347

Merged
bartekplus merged 2 commits intomasterfrom
fix/input-inline-suggestion-vertical-centering
Mar 24, 2026
Merged

fix: align inline suggestion with vertically centered input text#347
bartekplus merged 2 commits intomasterfrom
fix/input-inline-suggestion-vertical-centering

Conversation

@bartekplus
Copy link
Copy Markdown
Owner

@bartekplus bartekplus commented Mar 24, 2026

Summary

  • <input> elements vertically center their text, but the mirror <div> used for caret measurement top-aligns it after padding
  • This caused inline suggestions to appear shifted up (~4px) on inputs with extra height, such as GitHub's branch selector input
  • Added centering offset compensation: (contentHeight - lineBoxHeight) / 2 when the target is an <input>

Test plan

  • All 1604 existing tests pass
  • Verify inline suggestion alignment on GitHub branch selector input
  • Verify no regression on standard input fields (e.g. Google search, address bars)
  • Verify textarea suggestions are unaffected

🤖 Generated with Claude Code

bartekplus and others added 2 commits March 24, 2026 06:50
The caret measurement mirror <div> top-aligns text after padding, but
<input> elements vertically center their text.  This caused inline
suggestions to appear shifted up on inputs with extra height (e.g.
GitHub branch selector).  Account for the centering offset when the
target is an <input>.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Verifies that getCaretRect shifts the caret down for tall <input>
elements (which vertically center text) and leaves <textarea> behavior
unchanged.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@bartekplus bartekplus merged commit ce5e275 into master Mar 24, 2026
8 checks passed
@bartekplus bartekplus deleted the fix/input-inline-suggestion-vertical-centering branch March 24, 2026 06:04
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.

1 participant