phoenixframework / phoenix_live_view

Rich, real-time user experiences with server-rendered HTML
https://hex.pm/packages/phoenix_live_view
MIT License
6.18k stars 930 forks source link

Auth scaffolding password reset form duplicates password/confirm fields when using password manager #3471

Closed bkilshaw closed 5 days ago

bkilshaw commented 6 days ago

Environment

Actual behavior

When using the live view version of the password reset page generated by the auth scaffolding, when using a password manager to populate the password and confirm_password inputs, the fields get duplicated. This does not happen when populating the fields manually.

Chrome + 1Password: https://github.com/user-attachments/assets/f5de18f5-2006-4006-bcf8-3748655c66b8

Firefox https://github.com/user-attachments/assets/606811cf-0466-4d3d-813c-952d4b7b9cba

If you interact with the input first, and then use the password manager to generate a password, the issue doesn't happen:

https://github.com/user-attachments/assets/583d00ab-f0fb-4287-b368-473566dd29e3

Tested using Chrome + 1password as well as on Safari and Firefox using the built in password managers.

Expected behaviour

The fields should not get duplicated.

ryanwinchester commented 5 days ago

I still don't know why, but wrapping the inputs in a div makes it behave normally for me.

<div>
  <.input field={@form[:password]} type="password" label="New password" required />
  <.input
    field={@form[:password_confirmation]}
    type="password"
    label="Confirm new password"
    required
  />
</div>
SteffenDE commented 5 days ago

This is already solved on main. It was a bug in morphdom caused by LV patching nodes that aren't in the DOM in some cases. The PR in morphdom is https://github.com/patrick-steele-idem/morphdom/pull/258 and it was included in LV as part of https://github.com/phoenixframework/phoenix_live_view/commit/b1187f0ff13fd12f54dab0aba3e4c5e228075742.

Thank you for reporting, I hope we'll get a new RC out soon :)