Fix sidebar size and state on orientation change- Preserves sidebar s…#2219
Fix sidebar size and state on orientation change- Preserves sidebar s…#2219Elitex07 wants to merge 8 commits into
Conversation
…tate when rotating- Adjusts sidebar widths for landscape and portrait modes- Prevents animation flash on rotationFixes Acode-Foundation#2195
Greptile SummaryThis PR addresses a reported bug where the sidebar's open/closed state and dimensions were not correctly preserved across device orientation changes. It rewrites the
Confidence Score: 3/5The orientation-change state restoration — the PR's primary goal — does not work on the portrait→landscape path due to the flag being cleared during cleanup. The
Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[onWindowResize fires] --> B{innerWidth changed?}
B -- No --> Z[return]
B -- Yes --> C[snapshot wasActivated & previousMode]
C --> D{previousMode === 'tab'?}
D -- Yes --> E[wasOpenInTab = wasActivated && sidebarShown==='1']
D -- No --> F[wasOpenInTab unchanged]
E --> G{wasActivated?}
F --> G
G -- Yes, phone --> H[Inline phone cleanup: remove element, call onhide]
G -- Yes, tab --> I[Inline tab cleanup: remove margin/width/element]
G -- No --> J[hide true - also clears wasOpenInTab]
H --> K[update innerWidth & mode]
I --> K
J --> K
K --> L{new mode === 'tab'?}
L -- Yes --> M[shouldShow = wasOpenInTab OR sidebarShown==='1' - wasOpenInTab already false if path J ran]
L -- No --> N[shouldShow = false]
M --> O{shouldShow?}
N --> P[activated=false, sidebarShown=0]
O -- Yes --> Q[animationDuration=0s, show, reset after 100ms]
O -- No --> P
Reviews (4): Last reviewed commit: "fix: update sidebar activation logic to ..." | Re-trigger Greptile |
|
@greptile review again |
|
@greptile review again |
|
@greptile review again |
|
@bajrangCoder vo thoda formatting :) |
This comment has been minimized.
This comment has been minimized.
|
Preview Release for this, has been built. |
…tate when rotating- Adjusts sidebar widths for landscape and portrait modes- Prevents animation flash on rotation
Fixes: #2195