Repository navigation
fix(native-windows): switch to list tab on embedded editor back navigation - #952
Open
CookieDarb wants to merge 2 commits into
Open
CookieDarb wants to merge 2 commits into
CookieDarb wants to merge 2 commits into
Conversation
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.
What?
Closes #951
Fixes the issue where clicking the back button (e.g. "View Pages" / "View Posts") inside an embedded "Add New" editor tab does not return to the list view.
Why?
Native windows (like Posts and Pages) embed administrative pages (such as Gutenberg's Add New editor) via synthetic iframes inside native tab containers rather than top-level shell windows. Because synthetic iframes lack the shell-managed
Window.iframebinding that routes throughsrc/window/iframe-bridge.ts, in-frame navigation events (os-iframe-admin-link) posted by the chromeless bridge were ignored.When a user clicked the back button to return to the list view, the event was dropped, leaving the user unable to return to the item list from within the editor interface.
How?
src/native-windows.ts:os-iframe-admin-linklistener inbuildIframeContentRender()for synthetic iframe message dispatches.resolveNativeUrlRemap(): when the admin URL maps back to the current window, it extracts the target tab (supportingos_tabparameter with a fallback to the primary list tab) and triggers a tab switch viaos-tabsin place.tryNativeUrlRemap()and fallback unmapped admin links towindowManager.open().tests/vitest/native-window-iframe-admin-link.test.ts:os_tab, delegation to other native windows, classic window fallback, and listener teardown cleanup.Testing Instructions
Use of AI Tools
AI assistance: Yes
Tool(s): Antigravity
Model(s): Gemini
Used for: Diagnosing the root cause, aligning the implementation and adding tests. Final review and edits were made by me.
Open Question
When navigating back, should we prompt for unsaved changes or rely on keeping the tab mounted? Currently, switching tabs preserves the editor state in memory without destroying drafts.