Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

148
Visualizações
Resetting the keyboard tab position on a React SPA (Single page application)

I have a Single Page Application built using React. As usual, when changing between pages, the rendered components changes.

Problem

If I navigate to a button using Keyboard and press enter, it switches the component as expected. However, I want the page to reset the keyboard position to the start of the page. I tried a few solutions, but no luck.

Solutions I've tried:

document.activeElement.blur()

or

document.body.focus()

I've spun up a codesandbox example to illustrate the situation.

Link for the sandbox: https://codesandbox.io/embed/affectionate-snow-ctxi9

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda