Commit e8991b3
fix: [DHIS2-21286] scroll first failed field clear of sticky ScopeSelector
Two bugs caused validation-failure scroll to land in the wrong place:
1. withGotoInterface wrapped its class in forwardRef during the React 18
migration (09ed283). The outer ref then pointed at the inner field
component, not GotoFieldInterface, so .goto() silently no-op'd on every
D2Form section field. Drop the wrapper - no consumer reads the
forwarded ref.
2. Both goto() implementations did scrollIntoView() then post-corrected
with window.scroll(0, scrolledY - 48). The guard skipped the correction
whenever scrolledY === 0 (e.g. OccurredAt near top of doc), leaving the
field flush with the viewport top - and behind the sticky ScopeSelector
bar. Use scrollIntoView({block:'start'}) + scrollMarginTop:80px on the
wrapper so the browser lands the field 80px below the viewport top
regardless of position.
AI Assisted
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent ead5b8d commit e8991b3
2 files changed
Lines changed: 8 additions & 24 deletions
File tree
- src/core_modules/capture-core/components
- DataEntry/dataEntryField/internal
- FormFields/New/HOC
Lines changed: 2 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
| 22 | + | |
28 | 23 | | |
29 | 24 | | |
30 | 25 | | |
| |||
60 | 55 | | |
61 | 56 | | |
62 | 57 | | |
| 58 | + | |
63 | 59 | | |
64 | 60 | | |
65 | 61 | | |
| |||
Lines changed: 6 additions & 18 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
| 10 | + | |
17 | 11 | | |
18 | 12 | | |
19 | 13 | | |
20 | 14 | | |
21 | | - | |
22 | 15 | | |
23 | 16 | | |
24 | 17 | | |
| 18 | + | |
25 | 19 | | |
26 | 20 | | |
27 | | - | |
28 | | - | |
| 21 | + | |
29 | 22 | | |
30 | 23 | | |
31 | 24 | | |
32 | 25 | | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
| 26 | + | |
0 commit comments