linguabot commited on
Commit
1ae1cc1
·
verified ·
1 Parent(s): 370c00f

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. client/src/pages/TutorialTasks.tsx +16 -0
client/src/pages/TutorialTasks.tsx CHANGED
@@ -78,6 +78,18 @@ const TutorialTasks: React.FC = () => {
78
  const submissionsContainerRefs = useRef<{[key: string]: HTMLDivElement | null}>({});
79
  const withPreservedScroll = useRef<(fn: () => void) => void>();
80
 
 
 
 
 
 
 
 
 
 
 
 
 
81
  // Minimal, local scroll-stability helpers for submit/delete
82
  const lockListHeight = () => {
83
  const el = listRef.current;
@@ -787,6 +799,7 @@ const TutorialTasks: React.FC = () => {
787
 
788
  try {
789
  setMutatingTaskId(taskId);
 
790
  lockListHeight();
791
  lockCardHeightById(taskId);
792
  lockGridHeightById(taskId);
@@ -831,6 +844,7 @@ const TutorialTasks: React.FC = () => {
831
  unlockGridHeightById(taskId);
832
  }));
833
  setMutatingTaskId(null);
 
834
  }
835
  };
836
 
@@ -877,6 +891,7 @@ const TutorialTasks: React.FC = () => {
877
 
878
  try {
879
  if (taskId) setMutatingTaskId(taskId);
 
880
  lockListHeight();
881
  const response = await api.delete(`/api/submissions/${submissionId}`);
882
 
@@ -905,6 +920,7 @@ const TutorialTasks: React.FC = () => {
905
  unlockGridHeightById(taskId);
906
  }
907
  setMutatingTaskId(null);
 
908
  }));
909
  };
910
 
 
78
  const submissionsContainerRefs = useRef<{[key: string]: HTMLDivElement | null}>({});
79
  const withPreservedScroll = useRef<(fn: () => void) => void>();
80
 
81
+ const setGlobalAnchorDisabled = (disabled: boolean) => {
82
+ try {
83
+ if (disabled) {
84
+ document.documentElement.style.setProperty('overflow-anchor', 'none');
85
+ document.body.style.setProperty('overflow-anchor', 'none');
86
+ } else {
87
+ document.documentElement.style.removeProperty('overflow-anchor');
88
+ document.body.style.removeProperty('overflow-anchor');
89
+ }
90
+ } catch {}
91
+ };
92
+
93
  // Minimal, local scroll-stability helpers for submit/delete
94
  const lockListHeight = () => {
95
  const el = listRef.current;
 
799
 
800
  try {
801
  setMutatingTaskId(taskId);
802
+ setGlobalAnchorDisabled(true);
803
  lockListHeight();
804
  lockCardHeightById(taskId);
805
  lockGridHeightById(taskId);
 
844
  unlockGridHeightById(taskId);
845
  }));
846
  setMutatingTaskId(null);
847
+ setGlobalAnchorDisabled(false);
848
  }
849
  };
850
 
 
891
 
892
  try {
893
  if (taskId) setMutatingTaskId(taskId);
894
+ setGlobalAnchorDisabled(true);
895
  lockListHeight();
896
  const response = await api.delete(`/api/submissions/${submissionId}`);
897
 
 
920
  unlockGridHeightById(taskId);
921
  }
922
  setMutatingTaskId(null);
923
+ setGlobalAnchorDisabled(false);
924
  }));
925
  };
926