Initial curated projectbrain source from 8a7b1e0651dbdab97d744cbd2e653ab3970ac6c5
This commit is contained in:
commit
5aa3e8d685
700 files changed
+132801
No files matched your search
@@ -0,0 +1,19 @@
|
||||
type ScrollOptionsTarget = {
|
||||
scrollTo: (options: ScrollToOptions) => void;
|
||||
};
|
||||
|
||||
type FocusTarget = ScrollOptionsTarget & {
|
||||
focus: (options?: FocusOptions) => void;
|
||||
};
|
||||
|
||||
const topLeft: ScrollToOptions = { top: 0, left: 0, behavior: "auto" };
|
||||
|
||||
export const resetApplicationScroll = (
|
||||
main: FocusTarget | undefined,
|
||||
viewport: ScrollOptionsTarget,
|
||||
focusMain = true,
|
||||
) => {
|
||||
main?.scrollTo(topLeft);
|
||||
viewport.scrollTo(topLeft);
|
||||
if (focusMain) main?.focus({ preventScroll: true });
|
||||
};
|
||||
Reference in new issue
Block a user