Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

161
Vistas
Remove outline only on click event

I would like to remove the focusable HTML tags' outline only when focus is triggered by a click event. This means I would like to keep outline for tabbing.

Does anyone know a practice or library I could use here?

If not, my idea is attaching an event listener to window that listens to click events and is nullifying target style outline on focus in the global styled component.

Is that a viable solution?

(Using React)

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You don't need a library or JavaScript to do this. CSS has you covered. Use the focus-visible pseudo selector to help you out.

*:focus-visible {
    outline: 3px dashed rebeccapurple;
    outline-offset: 3px;
}
<button>Click me to see no focus but tab to me and you will see my focus</button>
<br>
<button>Click me to see no focus but tab to me and you will see my focus</button>

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda