linguabot commited on
Commit
d8cb4b7
·
verified ·
1 Parent(s): c91c6a9

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. client/src/pages/TutorialTasks.tsx +3 -6
client/src/pages/TutorialTasks.tsx CHANGED
@@ -194,11 +194,6 @@ const TutorialTasks: React.FC = () => {
194
  fn();
195
  return;
196
  }
197
- // Safari: disable compensation entirely to avoid oscillations
198
- if (isSafari) {
199
- fn();
200
- return;
201
- }
202
  if (disableCompensationRef.current.has(taskId)) {
203
  fn();
204
  return;
@@ -215,7 +210,9 @@ const TutorialTasks: React.FC = () => {
215
  const topAfter = el ? el.getBoundingClientRect().top : null;
216
  if (topBefore !== null && topAfter !== null) {
217
  const delta = topAfter - topBefore;
218
- if (delta !== 0) {
 
 
219
  try { console.log('[Trace] ScrollPreserve', { taskId, delta, topBefore, topAfter, scrollYBefore }); } catch {}
220
  window.scrollBy(0, delta);
221
  }
 
194
  fn();
195
  return;
196
  }
 
 
 
 
 
197
  if (disableCompensationRef.current.has(taskId)) {
198
  fn();
199
  return;
 
210
  const topAfter = el ? el.getBoundingClientRect().top : null;
211
  if (topBefore !== null && topAfter !== null) {
212
  const delta = topAfter - topBefore;
213
+ // Re-enable compensation on Safari but cap to small deltas to avoid oscillation
214
+ const allowComp = isSafari ? Math.abs(delta) <= 200 : true;
215
+ if (delta !== 0 && allowComp) {
216
  try { console.log('[Trace] ScrollPreserve', { taskId, delta, topBefore, topAfter, scrollYBefore }); } catch {}
217
  window.scrollBy(0, delta);
218
  }