Skip to content

Type-ahead: Keep ghost text from overlapping the next block - #1008

Merged
dkotter merged 2 commits into
WordPress:developfrom
yogeshbhutkar:type-ahead/do-not-overlap-content
Sep 11, 2026
Merged

dkotter merged 2 commits into
WordPress:developfrom
yogeshbhutkar:type-ahead/do-not-overlap-content

Conversation

@yogeshbhutkar

@yogeshbhutkar yogeshbhutkar commented Sep 7, 2026 •

Copy link
Copy Markdown
Contributor

What, Why, and How?

Type-ahead suggestions at the end of a block are drawn as an overlay, so they never take up space in the layout. When a suggestion wraps onto another line, it sits on top of the next content, and both become hard to read.

This change reserves that space in the block itself. While a suggestion is showing on a non-empty block with the caret at the end, a hidden copy of the same text is placed after the real content so the block grows to fit. The overlay still draws the visible ghost; the hidden copy only holds the height, and it is removed as soon as the suggestion goes away.

Use of AI Tools

AI assistance: Yes
Tool(s): Cursor
Model(s): Grok 4.6
Used for: Code review and solution suggestion.

Testing Instructions

  1. Create a new post and enable the type-ahead experiment.
  2. Create a paragraph with some content.
  3. Create another paragraph before the previous paragraph.
  4. Trigger an auto type-ahead generation by placing the caret at the end.
  5. Confirm that the generation does not overlap with the next block.

Screencasts

Before

before.mov

After

after.mov

Changelog Entry

Fixed - Reserve space for type-ahead text generation when caret is at the end.

Open WordPress Playground Preview

@codecov

codecov Bot commented Sep 7, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.50%. Comparing base (13b91a9) to head (6ce9881).

Additional details and impacted files
@@            Coverage Diff             @@
##             develop    #1008   +/-   ##
==========================================
  Coverage      81.50%   81.50%           
  Complexity      2923     2923           
==========================================
  Files            122      122           
  Lines          11653    11653           
==========================================
  Hits            9498     9498           
  Misses          2155     2155           
Flag Coverage Δ
unit 81.50% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 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.

@yogeshbhutkar
yogeshbhutkar marked this pull request as ready for review September 7, 2026 05:13
@yogeshbhutkar
yogeshbhutkar requested a review from a team September 7, 2026 05:13
@github-actions

github-actions Bot commented Sep 7, 2026 •

Copy link
Copy Markdown

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: yogeshbhutkar <yogeshbhutkar@git.wordpress.org>
Co-authored-by: dkotter <dkotter@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@yogeshbhutkar
yogeshbhutkar force-pushed the type-ahead/do-not-overlap-content branch from 42c2443 to ca88bb9 Compare September 11, 2026 04:12
@dkotter dkotter added this to the 1.4.0 milestone Sep 11, 2026
@dkotter
dkotter merged commit f0de1da into WordPress:develop Sep 11, 2026
58 of 59 checks passed
@yogeshbhutkar
yogeshbhutkar deleted the type-ahead/do-not-overlap-content branch September 11, 2026 21:22
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