Vertical alignment of `input_dark_mode()` icon
Nobody has claimed this yet.
- Dominant language
- SCSS
- Stars
- 569
- Forks
- 72
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 5
Description
When bringing in the dark mode switch, I noticed that the vertical alignment of the dark mode switch didn't quite line up with other icons. I thought at the time that this was a Bootstrap-specific issue, but after testing in Safari I've realized that it's likely a broader issue we should resolve (my initial testing was in Chrome).
The current state of things is that in input_dark_mode(), I disabled the vertical correction by setting the property to a space. https://github.com/rstudio/bslib/blob/b9ac2cfc0f69e08714648f8263b027fb7e9e8511/R/input-dark-mode.R#L45-L49
Users can still nudge the icon by including an inline style, e.g. style = css("--vertical-correction" = "-5px").
The Build-a-box app is a good example of the dark mode input in action.
However, with the vertical correction disabled, here's the icon appearance (on MacOS for each of these)
| Chrome | Firefox | Safari |
|---|---|---|
If I activate the original component rules by removing the space-toggle CSS variable from the input element, we get this:
| Chrome | Firefox | Safari |
|---|---|---|
(Basically they each move down by ~1px when the default vertical correction is used.)
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in R/input-dark-mode.R at lines 45-49 and inspect how the --vertical-correction setting affects the input_dark_mode() icon. Compare the icon across Chrome, Firefox, and Safari, using the Build-a-box app as a reference; done means consistent vertical alignment without removing users’ ability to override the correction.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- bootstrap, r, scss
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100