Skip to content

url-listeners is blocking native behaviour #4857

@christianalfoni

Description

@christianalfoni

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions