hackworthltd / primer-app

Primer's React frontend application.
GNU Affero General Public License v3.0
4 stars 0 forks source link

Automatically focus on the active definition #877

Closed dhess closed 1 year ago

dhess commented 1 year ago

When the student selects a definition, either in the definition list, or on the canvas, the canvas should automatically scroll such that the definition is centered in the viewport.

dhess commented 1 year ago

Recording a comment that @brprice had written in a corresponding Linear issue (now deleted):

I just tested using Firefox's native scrollIntoView, which does not work right (it scrolls the browser viewport, rather than panning the reactflow component). However, it seems that there are reactflow APIs to programmatically pan. See https://reactflow.dev/docs/api/react-flow-instance/#viewport, and an example at https://reactflow.dev/docs/examples/misc/use-react-flow-hook/

dhess commented 1 year ago

This was fixed in #927