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

url-listeners is blocking native behaviour #4857

Closed
christianalfoni opened this issue Sep 8, 2020 · 2 comments
Closed

url-listeners is blocking native behaviour #4857

christianalfoni opened this issue Sep 8, 2020 · 2 comments
Assignees

Comments

@christianalfoni
Copy link
Contributor

There has been several reports about clicking hyperlinks does not give the expected behaviour. We have two specific scenarios:

  1. create two .html files and create a link to move from one to the other. When you now change the code and save it refreshes the index.html file instead of the one you are on. Can not see the addressbar reflecting moving between HTML files at all

  2. Create hyperlinks with hashes pointing to IDs of elements on the page. The expected behaviour is that the preview window jumps to the element when you click the link. This does not happen

app/sandbox-hooks/url-listeners.js is the file that is responsible for intercepting URL changes and send them up to the addressbar (sendUrlChange). We still need this logic, but we want to re-evaluate the click listener further down in the file.

So I would suggest doing normal tracking here instead. One for popstate and one for hashchange:

https://gomakethings.com/how-to-detect-when-the-browser-url-changes-with-vanilla-js/

https://stackoverflow.com/questions/6390341/how-to-detect-if-url-has-changed-after-hash-in-javascript/37091484#37091484

@armujahid
Copy link
Contributor

Related: #2231

@christianalfoni
Copy link
Contributor Author

#4977

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

Successfully merging a pull request may close this issue.

3 participants