Fix active tab underline highlight in Appearance Add Theme view - #448
Merged
AllTerrainDeveloper merged 2 commits intoJul 29, 2026
Merged
Conversation
- Dynamically parse browse URL parameter on each mutation cycle in theme installer active tab script. - Add PHPUnit unit test to verify hook registration on admin_footer and inline script output.
CookieDarb
marked this pull request as ready for review
July 29, 2026 11:48
AllTerrainDeveloper
approved these changes
Jul 29, 2026
AllTerrainDeveloper
left a comment
Collaborator
There was a problem hiding this comment.
This looks great!
Thank you!
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 #447
Fixes the bug where the colored underline bar/highlight always stays stuck on "Popular" in the Appearance -> Add Theme (theme installer) screen and does not update when other tabs ("Latest", "Block Themes", "Favorites") are clicked.
Why?
The theme installer (
theme-install.php) runs in a chromeless iframe context (desktop_mode_chromeless=1). WordPress Core's legacy Backbone router updates the URL in place usinghistory.replaceStateorpushState, but it doesn't correctly update the DOM's active state tab classes in this environment because the initialbrowsequery parameter fromwindow.location.searchwas only evaluated once on initial page load, ignoring subsequent client-side URL changes.How?
includes/themes-tabs.php:desktop_mode_theme_install_active_tab_script()inline JavaScript to dynamically evaluate thebrowseURL query parameter on every DOM check via a helper functiongetBrowseParam(), rather than caching the initial query parameter.MutationObserveron.filter-linksto fetch the freshbrowseparameter on every mutation, correctly updating thecurrentclass andaria-current="page"attribute dynamically.tests/phpunit/tests/desktopModeInjectAppearanceTabs.php:test_theme_install_active_tab_script_registered_and_emits_dynamic_browse_param()to assert that the active tab script is hooked toadmin_footerat priority100and outputs the inline JS helper.Testing Instructions
Screencast
Screen.Recording.2026-07-29.at.4.57.38.PM.mov
Use of AI Tools
AI assistance: Yes
Tool(s): Antigravity
Model(s): Gemini
Used for: Reviewing the existing implementation and suggesting the changes. Final decisions and edits were made by me.