Add Exit Desktop Mode affordance to OS Settings → Appearance#103
Open
Add Exit Desktop Mode affordance to OS Settings → Appearance#103
Conversation
Adds a clearly labeled "Switch to Classic Admin" button at the bottom of the Appearance tab, so the only way out of the shell isn't buried in the admin bar. Reuses the existing save-desktop-mode admin-ajax endpoint via the desktopModeAdminBar global the admin-bar inline script already publishes (same nonce, same redirect contract). No new PHP surface, no new REST route. The admin-bar toggle stays as-is; both paths coexist. Closes #99
✅ WordPress Plugin Check Report
📊 ReportAll checks passed! No errors or warnings found. 🤖 Generated by WordPress Plugin Check Action • Learn more about Plugin Check |
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.
Summary
The only way to leave Desktop Mode from inside the shell was the admin-bar "Switch to Classic Admin" toggle, easy to miss for users not fluent with the WP admin bar. This PR adds a clearly labeled exit option to OS Settings → Appearance, the most discoverable surface.
Changes
src/settings/sections/exit.tsrendering a<wpd-section>+<wpd-button variant="secondary">at the bottom of the Appearance tab.src/settings/index.tsimportsbuildExitSectionand renders it as the last item inside the Appearance<wpd-tabpanel>.__( ..., 'desktop-mode' ).The admin-bar toggle in
includes/admin-bar.php+assets/js/admin-bar.jswas NOT touched, both paths coexist.Wording
Implementation note
Reuses the existing
save-desktop-modeadmin-ajax endpoint via thewindow.desktopModeAdminBarglobal already published byincludes/admin-bar.phpfor the admin-bar toggle. Same nonce, same redirect contract. Falls back to navigating todesktopModeConfig.adminUrlif the global isn't present.No new PHP surface (no new shell-config keys, no new REST route, no new nonce).
Verified
npm run buildclean (6 Vite targets)npm run lintcleantsc --noEmitcleannpm run test:js: 803 / 87 files all greenDesign choices to confirm
window.desktopModeAdminBar(always present on shell pages) instead of addingexitNonce+exitUrltodesktop_mode_shell_config. Lighter touch but couples the OS Settings bundle to the admin-bar bundle's global. Happy to switch to a dedicated config payload if preferred.secondarynotdanger: exiting the shell isn't destructive (no data loss, user can flip back any time), sodangerwould feel alarmist. Easy to adjust.Closes #99