fix(skin): verify real launcher dedup and keep split recovery tappable at 320px

- Fall back an overlapping docked recovery toolbar to the visible capsule so
  split built-in/library buttons never cover each other on narrow screens.
- Add browser fixtures mounting real HostChrome + real PluginPanel for group,
  split and legacy capsule modes, including a genuine 320px iframe viewport.
- Assert the real launcher is suppressed by toolbar slots and never duplicated
  after a bad-anchor fallback, with both split toolbars observable and clickable.
This commit is contained in:
OddTurtleHead committed 2026-11-26 23:06:43 +08:00
1 parent cfbf488f75
commit e5c891fc94
6 files changed
+543 -1

No files matched your search

+26 -1
View File
@@ -161,7 +161,7 @@ import {
type FloatingAvoidance,
type FloatingPosition,
} from "../services/host-floating-placement.js";
import { shouldShowRecovery } from "../services/host-chrome-visibility.js";
import { shouldShowRecovery, type HostPartRect } from "../services/host-chrome-visibility.js";
import { thirdPartyAllowed } from "../services/instance-authorization.js";
import {
RECOVERY_CONTROL_DEFAULTS,
@@ -474,6 +474,30 @@ function syncToolbarPopovers() {
);
}
/** A toolbar that is currently displayed (top layer or display fallback). */
function isToolbarShown(control: HTMLElement | null): boolean {
if (!control) return false;
if (control.matches?.(":popover-open")) return true;
const rect = control.getBoundingClientRect();
return getComputedStyle(control).display !== "none" && rect.width > 0 && rect.height > 0;
}
function rectOf(control: HTMLElement): HostPartRect {
const rect = control.getBoundingClientRect();
return {
left: rect.left, top: rect.top, width: rect.width, height: rect.height,
right: rect.right, bottom: rect.bottom,
};
}
/** Other docked recovery toolbars this entry must not cover on a narrow screen. */
function otherToolbarRects(control: HTMLElement): HostPartRect[] {
return [groupToolbarElement.value, builtInToolbarElement.value, libraryToolbarElement.value]
.filter((element): element is HTMLElement => Boolean(element)
&& element !== control && isToolbarShown(element))
.map(rectOf);
}
function bindToolbarEntry(
control: HTMLElement | null,
config: SkinChromeSlot | undefined,
@@ -487,6 +511,7 @@ function bindToolbarEntry(
skinId: hostChromeActiveSkinId.value,
align: config.align,
presentation: "toolbar",
otherControls: () => otherToolbarRects(control),
// A floating toolbar is a closed popover (display:none). Show it for the
// synchronous measurement/hit test and hide it again unless it docked.
prepare: () => syncRecoveryPopover(control, true),