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

120
Visualizações
How can I prevent firebase Web UI from scrolling down to the login section automatically?

When a user opens my website, I don't want the site scrolling down to the 'login' section automatically. I think that Firebase is scrolling down to the section when I perform:

var ui = new firebaseui.auth.AuthUI(firebase.auth());
ui.start("#firebaseui-auth-container", uiConfig);

http://launchpad.behavioralsight.com/

How can I prevent it from doing this?

about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

It doesn't seem like FirebaseUI can be configured to prevent scrolling. There is an open Github issue (and related StackOverflow question).

The scrolling happens in setupFocus_(). There are several versions depending on the widget type, but I think you are interested in passwordsignup.js.

The fix is quite simple: pass the preventScroll option to every call of focus() like this:

this.getEmailElement().focus({preventScroll:true});

If you want to get fancy, you can make this a configurable option of the AuthUI.start() method as suggested in the Github issue.


If you don't want to modify FirebaseUI, a work-around based on this related answer may work:

  1. Manually focus another element on your site (like the button.)
  2. Handle the focusout event as described in the answer above:

Before that, however, whatever had the focus will receive a "focusout" event of type FocusEvent. Suppose your event variable is e. The e.relatedTarget property will be populated with the element that's about to receive the focus. If you handle the "focusout" event by setting the focus back to the thing that's losing the focus e.target, then it will immediately re-receive the focus, along with a "focus" and "focusin" event, while the object that was going to receive the focus will neither receive the focus nor any focus events.

  1. Then remove this focusout handler so the login section can be focused after the initial auto focus.
about 4 years ago · Juan Pablo Isaza Relatório

0

Give this a try. It is preventing the field from even receiving focus since it isn't visible on the screen. Then after a second display the form.

HTML

<style>
  .loading #ui-sign-in-email-input { display: none; }
</style>
<div id="firebaseui-auth-container" class="loading"></div>
<div id="loader">Loading...</div>

JavaScript

...
uiShown: () => {
  setTimeout(() => {
    document.getElementById('firebaseui-auth-container').classList.remove('active');
  }, 500);
  document.getElementById('loader').style.display = "none";
},

...

about 4 years ago · Juan Pablo Isaza Relatório
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