mauricevancooten / react-anchor-link-smooth-scroll

React component for anchor links using the smooth scroll polyfill.
243 stars 31 forks source link

Default behaviour for href with anchor #17

Closed vvozibic closed 5 years ago

vvozibic commented 5 years ago

Hey, thanks for the good solution for smooth scroll.

I found a small features which I want to be see in library. Default behaviour for href with anchor is add #anchor to route, but it is a missed.

What do you think about added props like defaultPrevented for component?

I can make a PR with this feature.

tophsic commented 5 years ago

Do you mean that you would like to see #anchor appear in route and browser history? This can be related to #14, isn't it?

vvozibic commented 5 years ago

@tophsic No, I talk about #anchor in url. For example: we have url like http://localhost:4000 and we click in AnchorLink. Url doesn't change because click have e.prefentDefault(); I want to see change url to http://localhost:4000#anchor, because this is important for me.

I think feature for disable/enable preventDefault behaviour is important.

vvozibic commented 5 years ago

I just coped and pasted code from library and change this behaviour, because it's simple and trivial solution. But I think it's feature maybe useful for other people.

tophsic commented 5 years ago

No, I talk about #anchor in url. For example: we have url like http://localhost:4000 and we click in AnchorLink. Url doesn't change because click have e.prefentDefault(); I want to see change url to http://localhost:4000#anchor, because this is important for me.

My english seems too bad because that's what I meant ;) I am looking for the same thing so.

tophsic commented 5 years ago

Maybe I just was wrong to link the issue I mentioned.

vvozibic commented 5 years ago

@tophsic I just create PR soon :)

mauricevancooten commented 5 years ago

Feel free to submit a pull request with the feature and I will merge it into the repo!