react-scrollable-anchor icon indicating copy to clipboard operation
react-scrollable-anchor copied to clipboard

Breaks when <base> head element is used

Open tchock opened this issue 7 years ago • 2 comments

What I do: I am using <base href="/"> in the <head> of the html file and scrolling through the sections.

What I see: it won't update the hash relative to the path but will use the base path to append the hash to. This then goes to a complete new site because the router reacts to the route change.

What I expect: The route should stay the same, but only the hash should change.

Possible solution: In https://github.com/gabergg/react-scrollable-anchor/blob/master/src/utils/hash.js it should also use the rest of the path to build the complete URL instead of just updating the URL.

tchock avatar Jul 05 '18 13:07 tchock

I disagree with your solution. It's enough to call the method of Manager.handleHashChange in react-router changes moment. For example, add call that function to listen route history, history.listen(() => Manager.handleHashChange())

definder avatar Aug 31 '18 09:08 definder

@tchock Thanks, it's clearly an unexpected behaviour;

@definder Everybody is not supposed to use react-router.

GabrielDelepine avatar Nov 06 '18 08:11 GabrielDelepine