fix(mobile): scrolling within tree

This commit is contained in:
Elian Doran 2025-01-04 13:21:10 +02:00
parent 4dece78591
commit cdfd2827e8
No known key found for this signature in database

View File

@ -82,6 +82,11 @@ export default class SidebarContainer extends FlexContainer {
this.dragState = DRAG_STATE_DRAGGING;
}
if (this.currentTranslate !== -100) {
// Return early to avoid consuming the event, this allows the user to scroll vertically.
return;
}
} else if (this.dragState === DRAG_STATE_DRAGGING) {
const width = this.sidebarEl.offsetWidth;
const translatePercentage = Math.min(0, Math.max(this.currentTranslate + (deltaX / width) * 100, -100));
@ -90,6 +95,7 @@ export default class SidebarContainer extends FlexContainer {
this.backdropEl.style.opacity = String(Math.max(0, 1 + (translatePercentage / 100)));
}
// Consume the event to prevent the user from doing the back to previous page gesture on iOS.
e.preventDefault();
}