Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Swipe Gesture Support for Side Navigation in Kolibri #13177

Merged
merged 4 commits into from
Mar 11, 2025

Conversation

yashhash2
Copy link
Contributor

Summary

This PR introduces swipe gesture support for toggling the side navigation menu, enhancing the mobile user experience. The feature leverages useSwipe from @vueuse/core, ensuring seamless navigation for touch-screen devices. The implementation is non-intrusive and retains the existing navigation methods.Here is small GIF representing the change swip compress

References

ISSUE: swipe from left to open side nav on mobile #6899

Summary of changes:
1)Added swipe-to-open functionality for the side navigation menu.
2)Integrated useSwipe from @vueuse/core to manage swipe detection.
3)Implemented swipe gestures in two key components:
Main Wrapper: Swipe right to open the side navigation.
Side Navigation: Swipe left to close the navigation.
4) Provided RTL support using isRTL.

Reviewer guidance

Reviewers can test these changes by using kolibri app mode.

Q Is width for swipe zone fine or it needs some refinements?

@yashhash2 yashhash2 changed the title added swipe feature Add Swipe Gesture Support for Side Navigation in Kolibri Mar 8, 2025
@MisRob MisRob added the TODO: needs review Waiting for review label Mar 10, 2025
@MisRob MisRob removed the request for review from nucleogenesis March 10, 2025 08:04
@radinamatic
Copy link
Member

radinamatic commented Mar 10, 2025

Swipe works as expected in both RTL and LTR, good job @yashhash2 ! 👏🏽

APK asset tested on Android 12 phone.

Interaction is smooth and swipe width seems enough even for a fat-finger person like me 😅

RTL LTR
https://github.com/user-attachments/assets/efdc67c1-c869-4979-902d-590077614f53 https://github.com/user-attachments/assets/240f42fd-5492-46a4-9972-5b1a473a4125

Copy link
Member

@radinamatic radinamatic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you @yashhash2 ! 💯 👏🏽 :shipit:

Copy link
Member

@rtibbles rtibbles left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Glad that this was nice and straight forward to implement! A few little tweaks and we should be good to merge.

<div
v-if="windowIsSmall"
ref="swipeZone"
:class="{ 'rtl-swipe-zone': isRtl.value }"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You shouldn't need to reference the .value attribute in a template, isRtl should suffice.

opacity: 0;
}

.rtl-swipe-zone {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is necessary - our RTLCSS processing creates a separate CSS asset for RTL rendering which flips the left attribute above to right.

You may have needed this during testing if you were using devserver-hot - but if you test with CSS assets actually being built, I think you'll find this isn't necessary.

@@ -266,6 +267,8 @@
import useNav from 'kolibri/composables/useNav';
import useUser from 'kolibri/composables/useUser';
import useUserSyncStatus from 'kolibri/composables/useUserSyncStatus';
import { useSwipe } from '@vueuse/core';
import { ref, onMounted, getCurrentInstance } from 'vue';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Linting is failing because onMounted here is not used.

@yashhash2 yashhash2 force-pushed the my-awesome-changes branch from f0919fd to 61c116f Compare March 11, 2025 10:31
@yashhash2
Copy link
Contributor Author

Hey @rtibbles yes you are right RTLCSS handles the left to right positioning of swipe-zone, I have done the required changes please take a look : )

@rtibbles rtibbles self-assigned this Mar 11, 2025
@radinamatic
Copy link
Member

Confirming that the swipe works as expected with the APK that includes the latest changes, good to go! 🚀

Copy link
Member

@rtibbles rtibbles left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code changes as requested, manual QA still checks out!

@rtibbles rtibbles merged commit d0423ca into learningequality:develop Mar 11, 2025
37 checks passed
@MisRob
Copy link
Member

MisRob commented Mar 11, 2025

Thanks @yashhash2, this is a very nice update

@yashhash2
Copy link
Contributor Author

Thank you @MisRob , @radinamatic and @rtibbles for your review and help throughout, looking forward to contribute more : )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
TODO: needs review Waiting for review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants