Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Browser.Navigation.pushUrl to come after DOM update #153

Open
dbdbdb opened this issue Mar 30, 2019 · 0 comments
Open

Browser.Navigation.pushUrl to come after DOM update #153

dbdbdb opened this issue Mar 30, 2019 · 0 comments

Comments

@dbdbdb
Copy link

dbdbdb commented Mar 30, 2019

In a single page application when a link is clicked you get a call to

onUrlChange : Url -> msg

and the message is sent to

update : msg -> model -> ( model, Cmd msg )

In the update you typically return a Browser.Navigation.pushUrl command.

If you have a filled in password input field on the page then the pushUrl command (when executed) triggers a save password dialog in the browser. I only want the browser to save the password when the user submit the password, not when he/she clicks a link to leave the page that has the password on it.

One need to clear the password in the DOM before the Browser.Navigation.pushUrl command is executed. Returning a new model with the password being an empty string does not work since the pushUrl command is executed before the model is rendered into the dom.

I've solved it by using a port and doing all the history manipulation there. It's however fairly complicated even then to get the ordering of DOM updates and history updates in sync.

This is similar to the cases in issue #108, but not exactly the same.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant