sign_up: fix suggestions error when navigating away
When navigating away from the page, the field receives the 'focusout' event – but stops to be present in the DOM. Thus we need to check that the DOM element is actually present.
This commit is contained in:
parent
fccbbdf53a
commit
a5f2c84cbf
2 changed files with 2 additions and 2 deletions
|
@ -13,7 +13,7 @@ delegate('focusout', userNewEmailSelector, () => {
|
|||
const suggestedEmailSpan = document.querySelector(emailSuggestionSelector);
|
||||
|
||||
const suggestion = suggest(userEmailInput.value);
|
||||
if (suggestion && suggestion.full) {
|
||||
if (suggestion && suggestion.full && suggestedEmailSpan) {
|
||||
suggestedEmailSpan.innerHTML = suggestion.full;
|
||||
show(document.querySelector(suggestionsSelector));
|
||||
} else {
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
= f.label :email, "Email"
|
||||
= f.text_field :email, autofocus: true, placeholder: "Votre adresse email"
|
||||
|
||||
.suspect-email
|
||||
.suspect-email.hidden
|
||||
.email-suggestion-title
|
||||
Voulez-vous dire
|
||||
%span.email-suggestion-address blabla@gmail.com
|
||||
|
|
Loading…
Reference in a new issue