refactor: Make focusable elements responsible for scrolling themselves into bounds. (#9288)

* refactor: Make focusable elements responsible for scrolling themselves into bounds.

* chore: Add tests for scrolling focused elements into view.

* fix: Removed inadvertent `.only`.

* fix: Scroll parent block of connections into bounds on focus.
This commit is contained in:
Aaron Dodson
2025-08-28 11:28:40 -07:00
committed by GitHub
parent fd0aaedb10
commit 47307a9e53
11 changed files with 276 additions and 36 deletions

View File

@@ -1380,7 +1380,12 @@ export abstract class Field<T = any>
}
/** See IFocusableNode.onNodeFocus. */
onNodeFocus(): void {}
onNodeFocus(): void {
const block = this.getSourceBlock() as BlockSvg;
block.workspace.scrollBoundsIntoView(
block.getBoundingRectangleWithoutChildren(),
);
}
/** See IFocusableNode.onNodeBlur. */
onNodeBlur(): void {}