@dfosco/storyboard-react 4.2.0-alpha.13 → 4.2.0-alpha.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@dfosco/storyboard-react",
3
- "version": "4.2.0-alpha.13",
3
+ "version": "4.2.0-alpha.14",
4
4
  "type": "module",
5
5
  "dependencies": {
6
6
  "@base-ui/react": "^1.4.0",
7
- "@dfosco/storyboard-core": "4.2.0-alpha.13",
8
- "@dfosco/tiny-canvas": "4.2.0-alpha.13",
7
+ "@dfosco/storyboard-core": "4.2.0-alpha.14",
8
+ "@dfosco/tiny-canvas": "4.2.0-alpha.14",
9
9
  "@neodrag/react": "^2.3.1",
10
10
  "glob": "^11.0.0",
11
11
  "jsonc-parser": "^3.3.1",
@@ -68,13 +68,13 @@ export default forwardRef(function PrototypeEmbed({ id: widgetId, props, onUpdat
68
68
  const [expanded, setExpanded] = useState(false)
69
69
  const [filter, setFilter] = useState('')
70
70
  const [canvasTheme, setCanvasTheme] = useState(() => resolveCanvasThemeFromStorage())
71
- const { active: embedActive, activate: activateEmbed, performanceMode, tooMany } = useEmbedActive(widgetId, embedRef)
72
71
  const inputRef = useRef(null)
73
72
  const filterRef = useRef(null)
74
73
  const embedRef = useRef(null)
75
74
  const iframeRef = useRef(null)
76
75
  const inlineContainerRef = useRef(null)
77
76
  const modalContainerRef = useRef(null)
77
+ const { active: embedActive, activate: activateEmbed, performanceMode, tooMany } = useEmbedActive(widgetId, embedRef)
78
78
 
79
79
  const iframeSrc = useMemo(() => {
80
80
  if (!rawSrc) return ''
@@ -323,7 +323,18 @@ export default forwardRef(function TerminalWidget({ id, props, onUpdate, resizab
323
323
 
324
324
  const handleClick = useCallback(() => {
325
325
  if (phase === 'ended') return
326
- if (phase === 'live') termRef.current?.focus()
326
+ if (phase === 'live') {
327
+ // Save canvas scroll position — terminal focus can trigger browser scroll
328
+ const scrollEl = terminalRef.current?.closest('[class*="canvasScroll"]')
329
+ const scrollTop = scrollEl?.scrollTop
330
+ const scrollLeft = scrollEl?.scrollLeft
331
+ termRef.current?.focus({ preventScroll: true })
332
+ // Restore if browser scrolled anyway
333
+ if (scrollEl && (scrollEl.scrollTop !== scrollTop || scrollEl.scrollLeft !== scrollLeft)) {
334
+ scrollEl.scrollTop = scrollTop
335
+ scrollEl.scrollLeft = scrollLeft
336
+ }
337
+ }
327
338
  }, [phase])
328
339
 
329
340
  const handleStartSession = useCallback(() => {