-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
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
[docs] Theme mode switching is infinite when switching fast #44750
Comments
Hey @frontend-sensei, I'm unable to reproduce this, may I ask you to share a recording of it? |
Hi, @DiegoAndai Nice to meet you! Around the 20th second mark, you can see that I stopped pressing anything at all and the theme continues to switch. 2024-12-12.17-46-11.mp4 |
Thanks for the recording and nice to meet you as well @frontend-sensei 😊 I'll mark this as an enhancement for the website. If you (or anyone else stumbling here) are having similar issues with this in their apps, throttling the theme switching should alleviate the issue. This is probably due to overloading the state switching as the theme changing is an expensive operation at the moment, probably worsened by the amount of open tabs. |
Steps to reproduce
Steps:
https://mui.com/material-ui/customization/dark-mode/#toggling-color-mode
Current behavior
When more than 4 tabs opened, frequent theme mode changing starts infinite mode changing between all tabs.
Expected behavior
When user change theme modes, mode is changes only once user clicked.
Context
This is crucial to take a look, because such behavior may impact on people feeling which have problems while look at frequently changing screens from dark to light.
I think this is because the tabs synchronize data about the active mode of the theme. Because after closing the tabs, the problem disappears. Apparently, the tabs react to changes from other tabs asynchronously and at the same time send these changes to other tabs. And because of this event, the changes run back and forth
Your environment
npx @mui/envinfo
Search keywords: theme, mode, flickering, infinite
The text was updated successfully, but these errors were encountered: