Skip to content

Commit

Permalink
Fix: Auto scroll to instruction item when editing an instruction (#6361)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexandreSi authored Feb 19, 2024
1 parent e205805 commit 210e59f
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,18 @@ const InstructionOrExpressionSelector = <
);
};

React.useEffect(
() => {
if (selectedItemRef.current && scrollViewRef.current) {
scrollViewRef.current.scrollTo(selectedItemRef.current);
}
},
// When the component is mounted, if an item is already selected
// (this happens when a user edits an existing instruction), auto scroll
// to the item in the list.
[]
);

return (
<div
style={{
Expand Down

0 comments on commit 210e59f

Please sign in to comment.