Skip to content

Add Exit Desktop Mode affordance to OS Settings → Appearance#103

Open
epeicher wants to merge 1 commit intotrunkfrom
feat/99-exit-affordance-os-settings
Open

Add Exit Desktop Mode affordance to OS Settings → Appearance#103
epeicher wants to merge 1 commit intotrunkfrom
feat/99-exit-affordance-os-settings

Conversation

@epeicher
Copy link
Copy Markdown
Collaborator

@epeicher epeicher commented May 6, 2026

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

  • New src/settings/sections/exit.ts rendering a <wpd-section> + <wpd-button variant="secondary"> at the bottom of the Appearance tab.
  • src/settings/index.ts imports buildExitSection and renders it as the last item inside the Appearance <wpd-tabpanel>.
  • All UI strings wrapped via __( ..., 'desktop-mode' ).

The admin-bar toggle in includes/admin-bar.php + assets/js/admin-bar.js was NOT touched, both paths coexist.

Wording

  • Section heading: "Exit Desktop Mode"
  • Section description: "Switch back to the standard WordPress admin. You can return to Desktop Mode from the admin bar at any time."
  • Button label (idle): "Switch to Classic Admin" (matches the admin-bar toggle exactly)
  • Button label (busy): "Switching…"
  • Error: "Could not switch back to classic admin. Check your connection and try again."

Implementation note

Reuses the existing save-desktop-mode admin-ajax endpoint via the window.desktopModeAdminBar global already published by includes/admin-bar.php for the admin-bar toggle. Same nonce, same redirect contract. Falls back to navigating to desktopModeConfig.adminUrl if the global isn't present.

No new PHP surface (no new shell-config keys, no new REST route, no new nonce).

Verified

  • npm run build clean (6 Vite targets)
  • npm run lint clean
  • tsc --noEmit clean
  • npm run test:js: 803 / 87 files all green

Design choices to confirm

  • Cross-bundle global vs shell config: leaned on window.desktopModeAdminBar (always present on shell pages) instead of adding exitNonce + exitUrl to desktop_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.
  • Variant secondary not danger: exiting the shell isn't destructive (no data loss, user can flip back any time), so danger would feel alarmist. Easy to adjust.

Closes #99

Open WordPress Playground Preview

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
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 6, 2026

✅ WordPress Plugin Check Report

✅ Status: Passed

📊 Report

All checks passed! No errors or warnings found.


🤖 Generated by WordPress Plugin Check Action • Learn more about Plugin Check

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.

Add 'Exit Desktop Mode' affordance inside the shell (OS Settings / user menu)

1 participant