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

238
Vistas
how can google.com put a tab focus on an element that is not focusable

Please go to google.com and search for 'dictionary', navigate through tab key and select "skip to main content":

step1

After hitting enter, the dictionary element gets focused:

step2

When I inspect it, it's a div with a aria-level attribute with no tabindex.

step3

So my question is how can a non-focusable element gets focused like that?

EDIT: When I tried to save that exact div element into a global var and call focus, it never gets focused.

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

0

When you press Enter on that message, JavaScript code adds tabindex="-1" to the element and focuses it. Before Enter:

Google page with Elements panel showing no tabindex on the main content div

After:

Google page with Elements panel showing tabindex="-1" on the main content div

When focus leaves the element (presumably a blur event handler), JavaScript code removes the tabindex from the element.

You can see this if you right-click the element and reveal it in the Elements panel, then watch the element as you tab until you see that element again. For instance, if you click anywhere near the top of the body of the page after opening the Elements panel and Shift+Tab, eventually you get that same "Show main content" box again, and when you press Enter you can see the tabindex get added (and then see it get removed when you move away).

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