Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

237
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!