Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.
Go
fix(ui): skip scroll-fade mask on coarse-pointer devices (#10952)
AstralSolipsismb85485e7ccc5
diff --git a/packages/views/layout/compact-nav-sheet.test.tsx b/packages/views/layout/compact-nav-sheet.test.tsxindex 20d5acf443..465ea4660d 100644--- a/packages/views/layout/compact-nav-sheet.test.tsx+++ b/packages/views/layout/compact-nav-sheet.test.tsx@@ -1,4 +1,4 @@-import { beforeEach, describe, expect, it, vi } from "vitest";+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";import { renderWithI18n } from "../test/i18n";import { CompactNavSheet } from "./compact-nav-sheet";@@ -20,13 +20,23 @@ vi.mock("@multica/ui/components/ui/sidebar", () => ({}),}));vi.mock("./app-rail", () => ({ AppRail: () => <nav data-testid="rail" /> }));-vi.mock("./space-panel", () => ({- SpacePanelContent: ({ space }: { space: string | null }) => <div data-testid={`panel-${space}`} />,-}));+vi.mock("./space-panel", async () => {+ const { useContext } = await import("react");+ const { PanelScrollFadeContext } = await import("./panel-nav");+ return {+ SpacePanelContent: ({ space }: { space: string | null }) => (+ <div data-testid={`panel-${space}`} data-fade={String(useContext(PanelScrollFadeContext))} />+ ),+ };+});vi.mock("./app-shell-context", () => ({useAppShell: () => ({ space: "work", hasPanel: true }),}));+afterEach(() => {+ vi.unstubAllGlobals();+});+beforeEach(() => {state.pathname = "/acme/issues";state.isCompact = true;@@ -69,4 +79,18 @@ describe("CompactNavSheet content", () => {const { queryByTestId } = renderWithI18n(<CompactNavSheet />);expect(queryByTestId("rail")).toBeNull();});++ // Some Android WebViews paint the scroll-fade mask as a black block over+ // the panel rows, so touch screens drop it inside the sheet.+ it.each([+ { pointer: "coarse", fade: "false" },+ { pointer: "fine", fade: "true" },+ ])("sets the panel scroll fade to $fade on a $pointer pointer", ({ pointer, fade }) => {+ vi.stubGlobal("matchMedia", (query: string) => ({+ matches: query === `(pointer: ${pointer})`,+ }));+ state.openMobile = true;+ const { getByTestId } = renderWithI18n(<CompactNavSheet />);+ expect(getByTestId("panel-work")).toHaveAttribute("data-fade", fade);+ });});diff --git a/packages/views/layout/compact-nav-sheet.tsx b/packages/views/layout/compact-nav-sheet.tsxindex 6a493b2ea2..a6e2bfcd76 100644--- a/packages/views/layout/compact-nav-sheet.tsx+++ b/packages/views/layout/compact-nav-sheet.tsx@@ -13,6 +13,7 @@ import { useT } from "../i18n";import { useNavigation } from "../navigation";import { AppRail } from "./app-rail";import { useAppShell } from "./app-shell-context";+import { PanelScrollFadeContext } from "./panel-nav";import { SpacePanelContent } from "./space-panel";/**@@ -35,6 +36,7 @@ export function CompactNavSheet() {if (!isCompact) return null;const hasPanel = !!shell?.hasPanel;+ const coarsePointer = window.matchMedia("(pointer: coarse)").matches;return (<Sheet open={openMobile} onOpenChange={setOpenMobile}>@@ -53,7 +55,9 @@ export function CompactNavSheet() {<AppRail />{hasPanel && (<div className="my-2 mr-2 flex w-[260px] min-w-0 flex-col overflow-hidden rounded-xl bg-page-canvas shadow-[var(--surface-shadow)] ring-1 ring-surface-border">- <SpacePanelContent space={shell?.space ?? null} />+ <PanelScrollFadeContext.Provider value={!coarsePointer}>+ <SpacePanelContent space={shell?.space ?? null} />+ </PanelScrollFadeContext.Provider></div>)}</SheetContent>diff --git a/packages/views/layout/panel-nav.test.tsx b/packages/views/layout/panel-nav.test.tsxnew file mode 100644index 0000000000..c138e7d052--- /dev/null+++ b/packages/views/layout/panel-nav.test.tsx@@ -0,0 +1,34 @@+import { describe, expect, it, vi } from "vitest";+import { render, screen } from "@testing-library/react";+import { PanelBody, PanelScrollFadeContext } from "./panel-nav";++// jsdom drops `mask-image`, so the fade stands in as a style it keeps.+vi.mock("@multica/ui/hooks/use-scroll-fade", () => ({+ useScrollFade: () => ({ opacity: 0.5 }),+}));++function scroller() {+ return screen.getByText("rows").parentElement!;+}++describe("PanelBody scroll fade", () => {+ it("applies the scroll fade by default", () => {+ render(+ <PanelBody>+ <span>rows</span>+ </PanelBody>,+ );+ expect(scroller()).toHaveStyle({ opacity: "0.5" });+ });++ it("drops the scroll fade when the context turns it off", () => {+ render(+ <PanelScrollFadeContext.Provider value={false}>+ <PanelBody>+ <span>rows</span>+ </PanelBody>+ </PanelScrollFadeContext.Provider>,+ );+ expect(scroller()).not.toHaveAttribute("style");+ });+});diff --git a/packages/views/layout/panel-nav.tsx b/packages/views/layout/panel-nav.tsxindex aa1a7df6a7..1a8c145a14 100644--- a/packages/views/layout/panel-nav.tsx+++ b/packages/views/layout/panel-nav.tsx@@ -69,6 +69,14 @@ export function usePanelScrollRef() {return useContext(PanelScrollContext);}+/**+ * Whether `PanelBody` masks its scroll edges. Some Android Chromium/WebView+ * builds paint the mask's opaque stop as a solid black layer inside the+ * compact nav sheet, covering its rows, so the sheet turns the fade off on+ * touch screens, where scrolling already shows the overflow.+ */+export const PanelScrollFadeContext = createContext(true);+export function PanelBody({children,onClickCapture,@@ -80,10 +88,11 @@ export function PanelBody({}) {const ref = useRef<HTMLDivElement>(null);const fadeStyle = useScrollFade(ref, 24);+ const fade = useContext(PanelScrollFadeContext);return (<divref={ref}- style={fadeStyle}+ style={fade ? fadeStyle : undefined}onClickCapture={onClickCapture}onAuxClickCapture={onAuxClickCapture}className="scrollbar-slim min-h-0 flex-1 overflow-y-auto overscroll-contain px-2 pb-4 [&>section:first-child]:mt-0"