Skip to content

Revisions: Fix the classic revisions screen in a desktop window - #498

Merged
mmtr merged 4 commits into
trunkfrom
claude/issue-491-reproducibility-d7767b
Aug 5, 2026
Merged

Revisions: Fix the classic revisions screen in a desktop window#498
mmtr merged 4 commits into
trunkfrom
claude/issue-491-reproducibility-d7767b

Conversation

@mmtr

@mmtr mmtr commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator

Fixes #491

Proposed changes

The path from the post editor to the classic revisions screen, fixed end to end:

  • The link opens a desktop window, not a browser tab. The editor renders it through <ExternalLink>, which hard-codes target="_blank", and the bridge yielded on any target other than _self. A _blank on a /wp-admin/ URL is now claimed like any other admin link. _top, _parent, named targets and non-admin URLs still yield.
  • The window is called "Revisions", not "Browse Browse revisions". The label was the link's whole textContent, and Core pairs a visible label with a screen-reader one. Screen-reader text is now dropped, and a name the shell had to guess is replaced by the page's own screen name on load.
  • setTitle() repaints the title bar. It was writing to a node the slot painter had already replaced with a clone. Every window was in this state, so plugin setTitle and os-title-change were broken too.
  • "← Go to editor" is hidden and the revision tooltip is no longer clipped. Two page-scoped rules in chromeless.css.
  • Restoring lands in the editor window you already had open. The Revisions window closes instead of becoming a second editor next to the stale one.

Why are these changes being made?

Restoring a revision took you out of the shell and left you with two windows on the same post, one of them stale.

The restore is a document.location assignment in wp-admin/js/revisions.js, so no click reaches the bridge and WP's redirect lands wherever the frame is. The handoff is a named list (HANDOFF_SCREENS), not a general "crossing slugs hands off" rule, because the submenu tab strip re-points windows across slugs on purpose (Appearance → Menus).

Testing instructions

With Classic Editor active (the block editor path is the same, the link just lives in the sidebar):

  1. Create a post and update it a few times so it has several revisions.
  2. Open Posts, click the post, then Browse next to "Revisions: N" in the Publish box.
  3. Make sure a desktop window opens (not a browser tab), titled "Revisions" (not "Browse Browse revisions"), with no "← Go to editor" link, and the editor window still open behind it.
  4. Hover along the revision slider. Make sure the author + timestamp card is fully visible, in both normal and "Compare any two revisions" mode. On trunk its top is cut off by the window edge.
  5. Click Previous until "Restore This Revision" is enabled, then click it. Make sure the Revisions window closes, the editor window is focused, and it shows the restored content plus "Post restored to revision from …".
  6. Check the other targets still yield: Preview from the editor and any external docs link should still open real browser tabs, and cmd/ctrl-clicking Browse should still open one too.

🤖 Generated with Claude Code

Open WordPress Playground Preview

Five fixes behind one report.

The block editor's revisions sidebar links out with `target="_blank"`,
which the chromeless bridge yielded on, so a same-origin wp-admin URL
opened a raw browser tab. A `_blank` on an admin URL now opens a
desktop window instead. Every other target still yields.

The window took its name from the link's `textContent`, and Core's
revisions link is a visible label plus a screen-reader one, so it came
out "Browse Browse revisions". The label harvest skips
`.screen-reader-text` and collapses whitespace, and a label the shell
had to guess is replaced by the destination page's own screen name
once the iframe loads.

`setTitle()` wrote to a detached node. Layer 3's slot painter repaints
each slot from `cloneNode` copies, so the span the constructor captured
was already orphaned. Every window was in this state, which broke
plugin `setTitle` and `os-title-change` too.

"Go to editor" is hidden and the revision tooltip gets its clearance
back, both page-scoped in chromeless.css. The tooltip is positioned
upward from the control frame and only cleared the top of the viewport
because of the screen H1 that chromeless hides.

Restoring a revision is a `document.location` assignment, so WP's
redirect turned the Revisions window into a second editor beside the
stale one. A window opened on `revision.php` now closes when it leaves
that screen and routes where it landed through the normal
window-owns-a-slug rules.

Fixes #491

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
mmtr and others added 3 commits August 5, 2026 16:31
Claiming a `_blank` admin link handed it to the parent's normal slug
routing, which navigates the source iframe in place when the
destination shares the window's slug. That destroys the one thing the
`_blank` asked to keep. `deriveWindowId` treats `page` as identity but
not `tab`, so any plugin screen linking `admin.php?page=x&tab=b` from
`admin.php?page=x` hit it, and a `_blank` on a trash URL ran the
destructive branch in place for the same reason.

The bridge now claims a `_blank` only when the destination is a
different wp-admin file, the one call it can make without the shell's
slug rules, and flags the message `newContext` so the parent skips
both in-place branches. Everything else opens a browser tab as before.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The slot painter restores each slot from a snapshot cloned at
construction. Every other slot's default is fixed markup, but the
title's is derived state, so restoring it verbatim put the window's
original name back and left `config.title` reporting the new one. A
repaint fires whenever the slot registry mutates, so activating a
plugin that registers a window slot renamed every open window back to
whatever it started as.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Cuts the walkthroughs down to what the next reader needs, drops the
revision-specific examples from code that isn't revision-specific, and
removes the compat-layer doc entry now that the CSS says it in three
lines.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@mmtr
mmtr merged commit 0e6dcd6 into trunk Aug 5, 2026
5 checks passed
@mmtr
mmtr deleted the claude/issue-491-reproducibility-d7767b branch August 5, 2026 14:59
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.

Restore This Revision link is silently swallowed inside chromeless windows (no request fired)

1 participant