Skip to content

Commit 3bd70de

Browse files
committed
fix(frontend): end an overlay-scrollbar drag on pointercancel
A cancelled pointer stream (touch interruption, app switch) never fires pointerup, so the drag state stayed on and the window listeners stayed attached. The thumb also takes touch-action: none, so a touch drag moves it instead of scrolling the page. Also clarifies why modelLabel stops at the catalog's label and name: the caller still has the schema's own title to try before the raw id.
1 parent f4f9499 commit 3bd70de

2 files changed

Lines changed: 9 additions & 4 deletions

File tree

web/oss/src/components/OverlayScrollbar/index.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,13 +105,17 @@ const OverlayScrollbar = ({target}: OverlayScrollbarProps) => {
105105
const delta = ((moveEvent.clientY - startY) / travel) * scrollable
106106
target.scrollTop = startScroll + delta
107107
}
108+
// pointercancel too: a cancelled stream (touch interruption, app switch) never fires
109+
// pointerup, which would leave the drag state on and the listeners attached.
108110
const onUp = () => {
109111
setDragging(false)
110112
window.removeEventListener("pointermove", onMove)
111113
window.removeEventListener("pointerup", onUp)
114+
window.removeEventListener("pointercancel", onUp)
112115
}
113116
window.addEventListener("pointermove", onMove)
114117
window.addEventListener("pointerup", onUp)
118+
window.addEventListener("pointercancel", onUp)
115119
},
116120
[target, metrics],
117121
)
@@ -127,7 +131,8 @@ const OverlayScrollbar = ({target}: OverlayScrollbarProps) => {
127131
role="presentation"
128132
onPointerDown={handlePointerDown}
129133
className={[
130-
"pointer-events-auto absolute right-0.5 w-1.5 cursor-default rounded-full",
134+
// touch-none so a touch drag moves the thumb instead of scrolling the page.
135+
"pointer-events-auto absolute right-0.5 w-1.5 cursor-default touch-none rounded-full",
131136
"opacity-0 transition-opacity duration-150 group-hover:opacity-100",
132137
scrolling || dragging ? "!opacity-100" : "",
133138
].join(" ")}

web/packages/agenta-entity-ui/src/DrillInView/SchemaControls/connectionUtils.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -324,9 +324,9 @@ export function buildModelOptionGroups(
324324
}
325325

326326
/**
327-
* The display label for a picked model id, from the harness's curated catalog. Same precedence as
328-
* the picker's options, so a summary line reads the way the picker did. Returns null when the id
329-
* is not in the catalog, so callers can fall back to whatever they showed before.
327+
* The catalog's display label for a picked model id (`label`, then `name`). Null when the catalog
328+
* has neither, so a caller can try the schema's own title before falling back to the raw id; the
329+
* picker has no schema to consult, which is why it ends at `id` instead.
330330
*/
331331
export function modelLabel(
332332
capabilities: HarnessCapabilitiesMap | null | undefined,

0 commit comments

Comments
 (0)