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

Better mobile device detection for interactive examples buttons #250

Conversation

agriyakhetarpal
Copy link
Member

@agriyakhetarpal agriyakhetarpal commented Jan 10, 2025

Description

This PR closes #140; it moves the logic from the CSS styles for disabling the interactive buttons and uses a better heuristic via our JavaScript code; i.e., the navigator.userAgent's value to check what sort of device a user is on. As a fallback, the screen size check has also been kept. A resize handler with 250ms debouncing has also been added here to check the screen size if the buttons haven't been disabled already.

I have to note that this also disables them on devices like iPads and other tablets, which can be reconsidered if someone raises this point. The CSS has been removed, as #141 (comment) is not applicable due to the use of user agents to detect the platform.

cc: @gabalafou

@agriyakhetarpal agriyakhetarpal added the enhancement New feature or request label Jan 10, 2025
@agriyakhetarpal agriyakhetarpal added this to the 0.18.0 milestone Jan 10, 2025
@agriyakhetarpal agriyakhetarpal mentioned this pull request Jan 10, 2025
3 tasks
@agriyakhetarpal
Copy link
Member Author

I rebased and updated the changes to work with the caching of the try_examples.json file, so that the mobile device detection is also cached and the checks for the page's resize comply. Thanks for the review, @Carreau!

@agriyakhetarpal agriyakhetarpal merged commit fb52264 into jupyterlite:main Feb 12, 2025
6 checks passed
@agriyakhetarpal agriyakhetarpal deleted the fix/better-mobile-device-detection branch February 12, 2025 21:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Hide button, or warn about high data download on mobile.
2 participants