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

Support for user preferences like prefers-reduced-motion and prefers-color-scheme #16

Merged
merged 3 commits into from
Feb 7, 2021

Conversation

AlaricBaraou
Copy link
Collaborator

@AlaricBaraou AlaricBaraou commented Feb 7, 2021

Expose the two preference through a context provider to all childrens.

To test it, refer to your OS settings.

I'll update the demo to prevent all animation if prefers-reduced-motion = reduce and enable / disable dark theme based on prefers-color-scheme: dark

If a change is made in the preference while visiting the page, the provider / app will update in consequence.

The idea came from this tweet : https://twitter.com/ericwbailey/status/1351243179060768778

@codesandbox-ci
Copy link

codesandbox-ci bot commented Feb 7, 2021

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit bb6d6a0:

Sandbox Source
MR_main_a11y_features_test Configuration

@github-actions
Copy link

github-actions bot commented Feb 7, 2021

size-limit report 📦

Path Size
dist/a11y.cjs.production.min.js 3.32 KB (+6.5% 🔺)
dist/a11y.esm.js 3.2 KB (+7.39% 🔺)

@AlaricBaraou
Copy link
Collaborator Author

The context is not passed through the r3f canvas. If we need to access it outside and inside of it it's not convenient.
I'll give it a thought before merging.
Otherwise it works well and the demo have been adapted to showcase it.

@AlaricBaraou AlaricBaraou added the enhancement New feature or request label Feb 7, 2021
@AlaricBaraou AlaricBaraou changed the title tested and approved Support for user preferences like prefers-reduced-motion and prefers-color-scheme Feb 7, 2021
@AlaricBaraou AlaricBaraou merged commit 054ae4a into main Feb 7, 2021
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.

None yet

1 participant