-
-
Notifications
You must be signed in to change notification settings - Fork 238
fix: settings toggle should use input #1049
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
base: main
Are you sure you want to change the base?
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
2 Skipped Deployments
|
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
knowler
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a good change. I noticed these had some affordances I don’t typically associate with switches (i.e. activation on Enter).
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughReplaces the button-based Settings Toggle with a label+native Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches🧪 Generate unit tests (beta)
Tip Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
knowler
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is looking really good! Works as expected. I’ve got a couple of requests (incorporating the forced color mode styles and using :dir() instead of a class) and a few nits.
I didn’t leave it as a comment, but I also wonder if we should use logical properties for the dimensions (i.e. height, width as block-size, inline-size respectively). Reason being is that grid/flex layout are writing-mode/directionality aware.
| @media (forced-colors: active) { | ||
| /* make toggle tracks and thumb visible in forced colors. */ | ||
| button[role='switch'] { | ||
| & > span:last-of-type { | ||
| forced-color-adjust: none; | ||
| } | ||
|
|
||
| &[aria-checked='false'] > span:last-of-type { | ||
| background: Canvas; | ||
| border-color: CanvasText; | ||
|
|
||
| & > span { | ||
| background: CanvasText; | ||
| } | ||
| } | ||
|
|
||
| &[aria-checked='true'] > span:last-of-type { | ||
| background: Highlight; | ||
| border-color: Highlight; | ||
|
|
||
| & > span { | ||
| background: HighlightText; | ||
| } | ||
| } | ||
| } | ||
| .toggle--checkbox:checked.rtl + .toggle--background:before { | ||
| transform: translate(-17px); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I imagine this might have gotten dropped when merging as I believe it was added after you started your PR. Can we incorporate it somehow? If you don’t have Windows, you can emulate forced colours in Chrome devtools.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Has it not been incorporated into the theme in main.css? We should also add it to the tests since we're already doing dark and light mode
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Has it not been incorporated into the theme in main.css?
It probably should be, but it isn’t right now (there are some forced colours styles there, but they don’t apply to this).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see @media (prefers-contrast: more) for some styles, but that doesn’t apply for forced colours unfortunately. Why don’t we create a separate PR for that and we can ignore here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh yeah, I was suggesting issues, not volunteering lol
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok the latest commit should fix forced contrast styles. I will accept style tag to inline utility class translations if you've got them.
Screen.Recording.2026-02-11.at.12.49.29.PM.mov
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, my friend made this excellent Color Blind & Low Vision Simulator Chrome Extension
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did a quick test with Windows High Contrast Mode (Night sky theme) and Edge on Windows 11 and this is what I found:
- Looks like the label disappears when its enabled.
- There’s also a slight flicker for the “thumb” when it changes colour.
- When enabled the background and text colour is probably failing the minimum contrast ratio.
npmx-switch-forced-colors-win11-edge.mp4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, the label text color + background color/highlight is the crux of the issue. If --fg works in light mode, it doesn't work in dark mode.
Co-authored-by: Nathan Knowler <nathan@knowler.dev>
Co-authored-by: Nathan Knowler <nathan@knowler.dev>
Co-authored-by: Nathan Knowler <nathan@knowler.dev>
Co-authored-by: Nathan Knowler <nathan@knowler.dev>
Co-authored-by: Nathan Knowler <nathan@knowler.dev>
Co-authored-by: Nathan Knowler <nathan@knowler.dev>
knowler
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, one last set of changes all related to the transitions.
Co-authored-by: Nathan Knowler <nathan@knowler.dev>
Co-authored-by: Nathan Knowler <nathan@knowler.dev>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (2)
app/components/Settings/Toggle.client.vue (2)
7-7: RedundantdefineEmitswhen usingdefineModel.
defineModelinternally handles theupdate:modelValueemit, so the explicitdefineEmitsdeclaration is unnecessary and can be removed to reduce noise.♻️ Suggested change
-defineEmits(['update:modelValue'])
2-6: Unusedclassprop.The
classprop is defined but never applied in the template. When explicitly declared as a prop, Vue disables automatic class fallthrough, so any class passed by consumers will have no effect. Either remove the prop or apply it to the appropriate element (likely the outer<label>).♻️ Option A: Apply the class prop
<template> - <label :for="id"> + <label :for="id" :class="props.class">♻️ Option B: Remove unused prop
const props = defineProps<{ label: string description?: string - class?: string }>()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me! As usual, I’ll defer to others with regard to Vue related stuff.
I will follow up with the forced colors mode stuff at the theme-level.
…, update server component
# Conflicts: # app/components/Settings/Toggle.client.vue
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2



Update settings page toggle to use an
<input type="checkbox" />instead of a button. Wrap the whole thing in a label and hide the checkbox behind styled toggle, so the click/touch target is pretty huge. Use translate animation and style it to look about the same as before. Use theme color so all color modes are supported. Use locale dir to support right to left languages.Closes: #1028