Skip to content

Block editor: Show the hover outline on a block while the caret is in text - #85806

Closed
ellatrix wants to merge 1 commit into
trunkfrom
claude/hover-outline-editing-host
Closed

ellatrix wants to merge 1 commit into
trunkfrom
claude/hover-outline-editing-host

Conversation

@ellatrix

@ellatrix ellatrix commented Oct 28, 2026 •

Copy link
Copy Markdown
Member

What?

Follow up to #81798.

Shows the block outline on hover over a block's own element (a separator, a spacer, an image's frame, a group's padding, a list item's bullet) while the caret is in a paragraph, heading or list item, where the grab cursor already shows.

Why?

While the caret is in one of those blocks, the canvas is one editing host, so every block counts as editable content. The hover code only shows the outline over content that isn't editable, so the outline never showed there, while the cursor still shows grab.

On trunk, a press there doesn't drag the block yet while the caret is in text. #85801 makes it drag again, using the same rule as this PR, so the outline then matches the press.

How?

The hover check also counts the block's own element as draggable when it is only editable because of the editing host.

Testing Instructions

Open in Playground (a post with a paragraph, a spacer and another paragraph, open in the editor).

  1. Click into the first paragraph's text.
  2. Hover the spacer: the outline shows.
  3. Hover a paragraph's text: no outline.

The new e2e test shows the hover outline on a block while the caret is in text fails on trunk (in Chromium and WebKit) and passes with this change. It is tagged to run in Firefox and WebKit in CI too.

Testing Instructions for Keyboard

The outline is a pointer hover state. Keyboard behaviour is not changed.

Screenshots or screencast

Caret in the first paragraph, then hovering the spacer:

Before After
hover-outline-trunk-before.mp4
hover-outline-trunk-after.mp4

Use of AI Tools

Written with Claude Code (Claude Opus 5.5).

🤖 Generated with Claude Code

@github-actions github-actions Bot added the [Package] Block editor /packages/block-editor label Oct 28, 2026
@github-actions

github-actions Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

🤖 PR meta 🤖

Preview in WordPress Playground

🏷️ Labels

This pull request needs exactly one label indicating its type, and has 0.

  • Required: any label starting with [Type].
  • Found: none.

Read more about Type labels in Gutenberg. If you cannot add labels yourself, a reviewer can do it for you.

📦 Bundle size

Size Change: +18 B (0%)

Total Size: 8.56 MB

📦 View Changed
Filename Size Change
build/scripts/block-editor/index.min.js 542 kB +18 B (0%)

4cbf35d Run

🏁 Flaky tests

Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

Both users add blocks simultaneously, both changes appear (RTC WebSocket) in /test/e2e/specs/editor/collaboration/collaboration-sync.spec.ts, passed after 1 failed attempt.
Error: apiRequestContext.fetch: socket hang up
Call log:
  - → GET http://localhost:8889/wp-json/wp/v2/users?per_page=100
    - user-agent: Playwright/1.63.0 (x64; ubuntu 24.04) node/24.20 CI/1
    - accept: */*
    - accept-encoding: gzip,deflate,br
    - X-WP-Nonce: 1f9c1b3dab
    - cookie: wordpress_test_cookie=WP%20Cookie%20check; wordpress_logged_in_23778236db82f19306f247e20a353a99=admin%7C1793333482%7CE7jxf1DhNxIqj7VYuavVl6EGoM1mkPOmzUomEnVxz9z%7Cfb135943a14fd63ea3aa9e80a54e1211c052160212d28b240dfe8acf51e35977; wp-settings-time-1=1793160682

    at RequestUtils.rest (/home/runner/work/gutenberg/gutenberg/packages/e2e-test-utils-playwright/src/request-utils/rest.ts:111:39)
    at RequestUtils.listUsers (/home/runner/work/gutenberg/gutenberg/packages/e2e-test-utils-playwright/src/request-utils/users.ts:34:30)
    at RequestUtils.deleteAllUsers (/home/runner/work/gutenberg/gutenberg/packages/e2e-test-utils-playwright/src/request-utils/users.ts:106:44)
    at CollaborationUtils.teardown (/home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/collaboration/fixtures/collaboration-utils.ts:609:28)
    at Object.collaborationUtils (/home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/collaboration/fixtures/index.ts:31:5)
Undo restores the post selection when another synced entity is loaded (RTC WebSocket) in /test/e2e/specs/editor/collaboration/collaboration-undo-redo.spec.ts, passed after 1 failed attempt.
Error: expect(received).toMatchObject(expected)

- Expected  - 2
+ Received  + 2

  Object {
    "attributeKey": "content",
    "blockIndex": 0,
    "content": "abcdef",
-   "endOffset": 3,
-   "offset": 3,
+   "endOffset": 1,
+   "offset": 1,
  }

Call Log:
- Timeout 5000ms exceeded while waiting on the predicate
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/collaboration/collaboration-undo-redo.spec.ts:363:5
Undo restores the post selection when another synced entity is loaded in /test/e2e/specs/editor/collaboration/collaboration-undo-redo.spec.ts, passed after 1 failed attempt.
Error: expect(received).toMatchObject(expected)

- Expected  - 2
+ Received  + 2

  Object {
    "attributeKey": "content",
    "blockIndex": 0,
    "content": "abcdef",
-   "endOffset": 3,
-   "offset": 3,
+   "endOffset": 1,
+   "offset": 1,
  }

Call Log:
- Timeout 5000ms exceeded while waiting on the predicate
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/collaboration/collaboration-undo-redo.spec.ts:363:5
can be converted when nested to paragraphs in /test/e2e/specs/editor/blocks/list.spec.js, passed after 1 failed attempt.
Error: expect(received).toBe(expected) // Object.is equality

- Expected  - 1
+ Received  + 1

  <!-- wp:paragraph -->
- <p>one</p>
+ <p>ne</p>
  <!-- /wp:paragraph -->

  <!-- wp:paragraph -->
  <p>two</p>
  <!-- /wp:paragraph -->

Call Log:
- Timeout 5000ms exceeded while waiting on the predicate
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/blocks/list.spec.js:417:52
should cut and paste individual blocks with collapsed selection in /test/e2e/specs/editor/various/copy-cut-paste.spec.js, passed after 1 failed attempt.
Error: expect(string).toMatchSnapshot(expected) failed

  @@ -1,3 +1,3 @@
   <!-- wp:paragraph -->
  -<p>2Cut - collapsed selection</p>
  +<p>2</p>
   <!-- /wp:paragraph -->


    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/various/copy-cut-paste.spec.js:45:49
should hide UI when selection changes (by mouse) in /test/e2e/specs/editor/various/autocomplete-and-mentions.spec.js, passed after 2 failed attempts.
Error: apiRequestContext.fetch: socket hang up
Call log:
  - → DELETE http://localhost:8889/wp-json/wp/v2/users/17?force=true&reassign=1
    - user-agent: Playwright/1.63.0 (x64; ubuntu 24.04) node/24.20 CI/1
    - accept: */*
    - accept-encoding: gzip,deflate,br
    - X-WP-Nonce: a5b63e93f2
    - cookie: wordpress_test_cookie=WP%20Cookie%20check; wordpress_logged_in_23778236db82f19306f247e20a353a99=admin%7C1793333485%7CNpQYAV33aashfhgn5HnTry6aSbpWQ4qBsn0SAzY10wf%7Cfa1bb3ff727c29c139871f54bee2f522f8db8870ce324161dba93fa6d2636050; wp-settings-time-1=1793161093

    at RequestUtils.rest (/home/runner/work/gutenberg/gutenberg/packages/e2e-test-utils-playwright/src/request-utils/rest.ts:111:39)
    at RequestUtils.deleteUser (/home/runner/work/gutenberg/gutenberg/packages/e2e-test-utils-playwright/src/request-utils/users.ts:91:30)
    at map (/home/runner/work/gutenberg/gutenberg/packages/e2e-test-utils-playwright/src/request-utils/users.ts:116:51)
    at RequestUtils.deleteAllUsers (/home/runner/work/gutenberg/gutenberg/packages/e2e-test-utils-playwright/src/request-utils/users.ts:116:5)
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/various/autocomplete-and-mentions.spec.js:73:3

should indent and outdent level 1 in /test/e2e/specs/editor/blocks/list.spec.js, passed after 1 failed attempt.
TimeoutError: locator.click: Timeout 10000ms exceeded.
Call log:
  - waiting for locator('role=toolbar[name="Block tools"i]').locator('role=button[name="Indent"]')

    at Editor.clickBlockToolbarButton (/home/runner/work/gutenberg/gutenberg/packages/e2e-test-utils-playwright/src/editor/click-block-toolbar-button.ts:17:15)
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/blocks/list.spec.js:775:3
should indent and outdent level 2 in /test/e2e/specs/editor/blocks/list.spec.js, passed after 1 failed attempt.
TimeoutError: locator.click: Timeout 10000ms exceeded.
Call log:
  - waiting for locator('role=toolbar[name="Block tools"i]').locator('role=button[name="Indent"]')
    - locator resolved to <button id="_r_1b_" type="button" tabindex="-1" aria-label="Indent" aria-disabled="true" data-toolbar-item="true" data-truly-disabled="false" aria-describedby="components-button__description-19" class="components-button components-toolbar-button is-compact has-icon">…</button>
  - attempting click action
    2 × waiting for element to be visible, enabled and stable
      - element is not enabled
    - retrying click action
    - waiting 20ms
    2 × waiting for element to be visible, enabled and stable
      - element is not enabled
    - retrying click action
      - waiting 100ms
    18 × waiting for element to be visible, enabled and stable
       - element is not enabled
     - retrying click action
       - waiting 500ms

    at Editor.clickBlockToolbarButton (/home/runner/work/gutenberg/gutenberg/packages/e2e-test-utils-playwright/src/editor/click-block-toolbar-button.ts:17:15)
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/blocks/list.spec.js:933:3
should insert a line break on shift+enter in /test/e2e/specs/editor/blocks/list.spec.js, passed after 1 failed attempt.
Error: expect(received).toBe(expected) // Object.is equality

- Expected  - 1
+ Received  + 1

  <!-- wp:list -->
  <ul class="wp-block-list"><!-- wp:list-item -->
- <li>a<br></li>
+ <li><br></li>
  <!-- /wp:list-item --></ul>
  <!-- /wp:list -->

Call Log:
- Timeout 5000ms exceeded while waiting on the predicate
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/blocks/list.spec.js:1210:52
should keep a full selection when outdenting nested items with Shift+Tab in /test/e2e/specs/editor/blocks/list.spec.js, passed after 1 failed attempt.
TimeoutError: locator.click: Timeout 10000ms exceeded.
Call log:
  - waiting for locator('role=toolbar[name="Block tools"i]').locator('role=button[name="Indent"]')

    at Editor.clickBlockToolbarButton (/home/runner/work/gutenberg/gutenberg/packages/e2e-test-utils-playwright/src/editor/click-block-toolbar-button.ts:17:15)
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/blocks/list.spec.js:1166:3
should not have a dead zone between blocks (lower) in /test/e2e/specs/editor/various/writing-flow.spec.js, passed after 1 failed attempt.
Error: expect(locator).toBeVisible() failed

Locator: locator('role=button[name="Add block"i]')
Expected: visible
Timeout: 5000ms
Error: element(s) not found

Call log:
  - Expect "toBeVisible" locator('role=button[name="Add block"i]') with timeout 5000ms
  - waiting for locator('role=button[name="Add block"i]')

    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/various/writing-flow.spec.js:981:28
should update the URL from the last navigation if only varies in the URL fragment in /test/e2e/specs/interactivity/router-navigate.spec.ts, passed after 1 failed attempt.
Error: expect(locator).toHaveText(expected) failed

Locator:  getByTestId('title')
Expected: "Link 1"
Received: "Main"
Timeout:  5000ms

Call log:
  - Expect "toHaveText" getByTestId('title') with timeout 5000ms
  - waiting for getByTestId('title')
    14 × locator resolved to <h2 data-testid="title">Main</h2>
       - unexpected value "Main"

    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/interactivity/router-navigate.spec.ts:160:25
themes can override registered templates (Site Editor v2) in /test/e2e/specs/site-editor/template-registration.spec.js, passed after 1 failed attempt.
Error: expect(locator).toBeVisible() failed

Locator: getByText('AuthorEmptytheme')
Expected: visible
Error: strict mode violation: getByText('AuthorEmptytheme') resolved to 5 elements:
    1) <div data-wp-c16t="true" data-wp-component="Flex" class="e518617e7c3a18e7__flex _3896336788892095__items-row cc39999a5fb580d4__expanded-row components-flex dataviews-view-grid__field">…</div> aka locator('[id="emptytheme//category"]').getByText('AuthorEmptytheme')
    2) <div data-wp-c16t="true" data-wp-component="Flex" class="e518617e7c3a18e7__flex _3896336788892095__items-row cc39999a5fb580d4__expanded-row components-flex dataviews-view-grid__field">…</div> aka locator('[id="emptytheme//custom-template"]').getByText('AuthorEmptytheme')
    3) <div data-wp-c16t="true" data-wp-component="Flex" class="e518617e7c3a18e7__flex _3896336788892095__items-row cc39999a5fb580d4__expanded-row components-flex dataviews-view-grid__field">…</div> aka locator('[id="emptytheme//index"]').getByText('AuthorEmptytheme')
    4) <div data-wp-c16t="true" data-wp-component="Flex" class="e518617e7c3a18e7__flex _3896336788892095__items-row cc39999a5fb580d4__expanded-row components-flex dataviews-view-grid__field">…</div> aka locator('[id="emptytheme//singular"]').getByText('AuthorEmptytheme')
    5) <div data-wp-c16t="true" data-wp-component="Flex" class="e518617e7c3a18e7__flex _3896336788892095__items-row cc39999a5fb580d4__expanded-row components-flex dataviews-view-grid__field">…</div> aka locator('[id="emptytheme//tag"]').getByText('AuthorEmptytheme')

Call log:
  - Expect "toBeVisible" getByText('AuthorEmptytheme') with timeout 5000ms
  - waiting for getByText('AuthorEmptytheme')

    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/site-editor/template-registration.spec.js:191:56

4cbf35d Run

… text

While the caret is in a paragraph, heading or list item, the canvas is one
editing host, so every block counts as editable and the hover outline never
showed, although the grab cursor does. Count the block's own element as
draggable when it is only editable because of the editing host.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ellatrix
ellatrix force-pushed the claude/hover-outline-editing-host branch from 99421b9 to 4cbf35d Compare October 28, 2026 03:54
@ellatrix
ellatrix changed the base branch from claude/list-drag-drop-bullet-6bff92 to trunk October 28, 2026 03:54
@ellatrix ellatrix changed the title Block editor: Show the hover outline on draggable blocks while the caret is in text Block editor: Show the hover outline on a block while the caret is in text Oct 28, 2026
@ellatrix ellatrix closed this Nov 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Package] Block editor /packages/block-editor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant