-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Bug: Theme switcher element and labeling is incorrect #4044
Comments
Thanks @thatblindgeye, the previous issue we had about this: #3497 |
@thatblindgeye @KevinMulhern I would love to work on this. While I was working on other a11y issues before I have noticed the theme switcher's weird a11y issue but did not immediately come up with an idea to fix it. But it seems a bit complicated since it is a link to turbo method, what should we do? |
@KevinMulhern any input on the above? Is there a reason we're using a link with a turbo method in the first place? |
@thatblindgeye yep Turbo is what allows us to switch themes without a page refresh - but changing the element to a button shouldn't be an issue - it'll still work.
This is likely the hardest problem to solve, we're limited with how much space we have in the navbar. More-so now we have the support link. But we might be able to do something like this:
Leave this one with me, there are a few optimisations we can make. |
Gotcha, wasn't sure if there was any other reason. We should be able to just update the class of our
Whether we'd want to adjust that top navbar could be another discussion, but we could definitely keep the theme switcher as just an icon for now. Implementing a dropdown to toggle open (rather than simply switching between light and dark) would be a nice to have as well though maybe that could be a followup to this issue (unless @luuu-xu really wants to dig into that)
👍🏼 if it's any consolation I think the issue wasn't as bad on Chrome (I had noticed it more on Firefox). |
We'll still need to hit that endpoint when clicking the button unfortunately, it persists the users theme choice so it won't change back to the default when navigating to other pages. |
@thatblindgeye I've made a few optimisations in this PR. Theres still a little bit of delay because it needs to make a server round trip, but the icon and theme will change at the same time now. Long term, we're better moving most of this to the frontend and persisting the theme in the background. Our mobile and desktop theme switcher being in two different parts of the app layout are whats preventing that at the moment. But I have plans for consolidating and improving the navigation soon ™️ |
Because: * There is a noticeable delay between switching the theme and the theme icon updating * Related to: #4044 This commit: * Toggles the theme class in the same turbo stream request we use to update the theme icon. * Adds a custom turbo stream action to toggle classes on elements Before: https://github.com/TheOdinProject/theodinproject/assets/7963776/6870d2a3-27af-413a-9df8-3adca85d6c4d After: https://github.com/TheOdinProject/theodinproject/assets/7963776/28cbb153-2348-4976-b11a-8245d85143fd
Complete the following REQUIRED checkboxes:
Bug: brief description of bug
format, e.g.Bug: Lesson complete button does not update on click
The following checkbox is OPTIONAL:
1. Description of the Bug:
The theme switcher has a few issues:
title
element removed, and the switcher should no longer be labelled based on it (remove thearia-labelledby
2. How To Reproduce:
3. Expected Behavior:
4. Desktop/Device:
5. Additional Information:
The text was updated successfully, but these errors were encountered: