thoughtbot / thoughtbot/roux

Curious learner: What's the reason for the multiple input focus styles?

Open
#14 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
CSS
Stars
93
Forks
4
PR merge metrics
No merged PRs in 30d

Description

Asking this because I'm curious and slightly out of my depth with my css-fu. And because hopefully it may help future others and serve as documentation for the thinking behind some of the detail of Roux's boilerplate!

In _forms.css Roux styles the focus state of form inputs in 2 places (code snippets abbreviated below):

:is(input) {
  &:focus {
    outline: var(--border-width--base) solid var(--color--primary-base);
  }
}
:where(input:not([type])) {
  &:focus-visible {
    outline: var(--border-width--thick) solid var(--color--focus);
    outline-offset: 2px;
  }
}

Some questions from ignorance:

  • What is the intention with setting this in both the :is and :where blocks?
  • Why &:focus vs &:focus-visible?
  • I see the :where block with :&:focus-visible has --border-width--thick but I can't seem to see this in the app when I focus on an input
  • If I want to update the default behaviour for input focus which should I use?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with _forms.css and compare the two input focus blocks named in the issue. Verify their behavior in the app, then document the intent of each selector, the difference between :focus and :focus-visible, and which block controls default input focus styling.

Written by the indexing model from the issue text.

Assessment

Tech stack
css
Domain
documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.