mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-05-25 08:59:46 +02:00
Keep sidebar and cmd+p items in view
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
import { useEffect } from 'react';
|
||||
|
||||
export function useScrollIntoView<T extends HTMLElement>(node: T | null, active: boolean) {
|
||||
useEffect(() => {
|
||||
if (active) {
|
||||
node?.scrollIntoView({ behavior: 'smooth', block: 'nearest' });
|
||||
}
|
||||
}, [active, node]);
|
||||
}
|
||||
Reference in New Issue
Block a user