Upload folder using huggingface_hub
Browse files
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 |
-
|
|
|
|
|
|
|
| 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 |
}
|