Repository navigation
Open the import row in the shell, not in a browser tab - #9
Merged
Merged
Conversation
The row carried a URL and left the opening to the shell, which was the
wrong reading of its contract. A constellation routes a row's URL into a
window only when there is an admin menu behind it; on a **system** tile
there is none, so its last resort for a URL-only row is
window.open( sub.url, '_blank', 'noopener,noreferrer' )
-- and clicking "Import forms" threw the page out of the desktop into a
browser tab, which is the one thing a desktop exists not to do.
The row now carries an `onSelect` that opens the page through
`wp.os.windowManager.open()`, the same call the shell makes for an admin
URL of its own, under a stable id so a second click focuses the window
instead of opening another. Without a shell it navigates, because a
pop-up the browser may block is not a fallback.
Verified on the desktop with `window.open` instrumented: zero calls, one
browser tab, one `allterrain-forms-import` window, and still one after
clicking the row again.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0119U4sRRWGcTQdwYreTwpAp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reported from the desktop: clicking Import forms in the dock's hover submenu opened the page in a new browser tab instead of a window in the shell.
Why
I gave the row a
urland left the opening to the shell, on the strength of its type doc — "urlstays the fallback for anything that can express itself as one". That sentence is about menu tiles. The constellation'srunRow()reads:Ours is a system tile registered with
registerSystemTile(), so there is nomenuItembehind it and no routing to fall into. A URL-only row is, by that code's own reasoning, a link out — correct for the row it was written for ("View site"), exactly wrong for an admin page.The fix
The row now carries an
onSelectthat opens the page itself, throughwp.os.windowManager.open()— the same call the shell makes when it routes an admin URL of its own:allterrain-forms-import), so a second click focuses the open window instead of stacking another; singleton reuse is the manager's documented behaviour for a window withoutmulti.windowIddeclared on the row, so the constellation lists it under "Open windows" when it is open rather than offering to open a second copy.urlkept in step with what the callback opens — the shell now reads the callback, but the URL is what the row means, and it is the value the fallback uses.window.open: a pop-up the browser is entitled to block is not a fallback.Verified on the desktop, with instrumentation this time
I saw this new tab in my own testing of the previous PR and waved it off as an automation artifact. It wasn't, so this round is measured rather than eyeballed —
window.openwas patched with a counter before clicking:window.opencallsallterrain-forms-importwindows in the shellThe window renders the import page correctly, listing the seeded Contact Form 7 form.
Tests: 2 new vitest cases pinning the behaviour — the row's
onSelectcallswindowManager.openwith the right id, url and title, and the no-shell path navigates instead. 248 vitest green,tscclean.🤖 Generated with Claude Code
https://claude.ai/code/session_0119U4sRRWGcTQdwYreTwpAp