question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Checkbox] Control still has the blue outline on focus, even wih focus-visible package applied

See original GitHub issue

Describe the bug

The checkbox square has a blue outline color when focused with mouse click, despite the focus-visible package being used.

To reproduce

  1. npm i focus-visible
  2. add import "focus-visible/dist/focus-visible" to _app.js
  3. add a <Checkbox/> element

Expected behavior

The blue outline should only be visible when using keyboard navigation, just like with Button etc.

System information

@chakra-ui/core”: “^1.0.0-rc.5”, “next”: “9.5.3”,

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:22
  • Comments:18 (5 by maintainers)

github_iconTop GitHub Comments

20reactions
ehyndscommented, Apr 7, 2022

Another option if you want to set this globally in your theme:

const theme = extendTheme({
  components: {
    Checkbox: {
      baseStyle: {
        control: {
          _focus: {
            boxShadow: 'none',
          },
        },
      },
    }
  }
});
7reactions
lingyun-zcommented, Apr 15, 2021

I added these in my global theme and it works as expected.

*:focus {
  box-shadow: none !important;
}

*[data-focus] {
  box-shadow: none !important;
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

focus-visible - CSS: Cascading Style Sheets - MDN Web Docs
The :focus-visible pseudo-class applies while an element matches the :focus pseudo-class and the UA (User Agent) determines via heuristics ...
Read more >
The :focus-visible Trick | CSS-Tricks
Always worth repeating: all interactive elements should have a focus style. That way, a keyboard user can tell when they have moved focus...
Read more >
bootstrap button shows blue outline when clicked
I've found out that the outline property was being set by Bootstrap as outline: 5px auto -webkit-focus-ring-color; .
Read more >
New Success Criteria in WCAG 2.2 - TPGi
An outline style of 1px solid is sufficient for conformance, but I recommend 2px solid to make it even clearer. A focus outline...
Read more >
Accessibility - React
Every HTML form control, such as <input> and <textarea> , needs to be labeled accessibly. ... Blue keyboard focus outline around a selected...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found