Skip to content

Hide native browser tabs while plugin dialogs are open - #4946

Closed
ariofrio wants to merge 4 commits into
get-bb:mainfrom
ariofrio:ariofrio/hide-browser-tabs-for-plugin-dialogs
Closed

ariofrio wants to merge 4 commits into
get-bb:mainfrom
ariofrio:ariofrio/hide-browser-tabs-for-plugin-dialogs

Conversation

@ariofrio

@ariofrio ariofrio commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Human comments

What was wrong

A Browser tab's native view paints above all renderer DOM, so bb hides it while useIsBrowserDimmingModalOpen() is true. Only host overlays raise that counter: the app build swaps in the real useBrowserDimmingModal, but plugins vendor the registry's no-op flavor, so a plugin Dialog never hides the view and sits under the page. Reported in #3812; this implements the host-side observer VKirill proposed there on 2026-09-23, scoped to dialogs.

What changed

useIsBrowserDimmingModalOpen in apps/app/src/hooks/useBrowserDimmingModal.ts now also reports true while an open plugin dialog portal is in the document: a plugin-rooted, portaled role="dialog" without data-side, a compact-viewport dialog drawer, or role="alertdialog". One shared MutationObserver, read through useSyncExternalStore, tracks those portals and notifies subscribers only for mutations that touch a plugin portal. The existing browser-view coordinator does the hiding and restoring. Already-shipped plugins benefit without a rebuild, and the host counter is unchanged. No wire, CLI, or SDK change.

Deviations from the proposal in #3812:

  • It matches only plugin-rooted, portaled dialogs, not every role="dialog", menu, or listbox, and adds no data-bb-browser-dimming marker, so unrelated DOM can't toggle the view.
  • Radix Popover content also has role="dialog". It is excluded via Popper's data-side, so plugin popovers and menus behave like host ones: the shared dropdown, context menu, and popover don't hide the view (only PaneMaximizeButton's menu opts in). Covering menus everywhere is a separate change, as Hide the native browser view behind any overlay that covers it #3755 attempted.
  • In compact viewports, plugin popovers, menus, selects, and dialogs share one persistent drawer. Only the Dialog drawer sets aria-describedby (in shared-ui and the vendored registry copy), so only it hides the view, matching host drawers.
  • Plugin AlertDialogs are included, because a confirmation hidden under the page is the same bug.

Because #3812's original repro is a plugin context menu built from plain DOM, this PR references the issue rather than closing it.

How you verified

apps/app/src/components/ui/dialog.browser-dimming.test.tsx renders real plugin-scoped content (inside PluginContext):

  • A plugin Dialog hides the view until it closes or unmounts. This failed on upstream main and passes now.
  • A plugin AlertDialog hides the view.
  • A plugin Popover leaves the view visible.
  • In a compact viewport, a plugin Dialog drawer hides the view and a plugin Popover drawer does not.

The AlertDialog, Popover, and compact Popover cases each failed before their fix and pass after it. pnpm exec turbo run test --filter=@bb/app on that file plus PaneMaximizeButton, portal-scope, BrowserTabContent, and responsive-overlay tests (66/66), pnpm exec turbo run typecheck --filter=@bb/app, and oxfmt --check pass. Supersedes #4444, which the contributor gate closed. Motivating plugin: Ribbon's dialogs, e.g. the action editor in ariofrio/ribbon#121.

Refs #3812

Written by Claude and Codex

🤖 Generated with Claude Code

AGENT GENERATED

ariofrio and others added 4 commits October 5, 2026 17:03
Radix Popover content also carries role="dialog", so the plugin dialog
selector matched open plugin popovers and hid the page, unlike host
popovers. Exclude popper content (data-side) and include alert dialogs.
Test with real plugin-scoped Dialog, AlertDialog, and Popover content.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
In compact viewports plugin popovers, menus, and dialogs all render as
the same persistent drawer, so the plugin dialog selector hid browser
views for any of them while host popover drawers leave the page alone.
Only dialog drawers carry aria-describedby, so match those and keep
other plugin drawers visible like their host counterparts.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions

Copy link
Copy Markdown
Contributor

This is an automated message. We have closed this pull request because it has been open for more than two weeks.

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.

1 participant