Skip to content

Full support for anchor tags #2074

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

Closed
Overdrivr opened this issue Feb 26, 2018 · 1 comment
Closed

Full support for anchor tags #2074

Overdrivr opened this issue Feb 26, 2018 · 1 comment

Comments

@Overdrivr
Copy link

What problem does this feature solve?

Anchor tags cannot be implemented correctly in the current state of things. There are a few techniques to hack a way around, but none of them seem to cover all the following cases:

  • Paths with anchors should always lead to the anchor if reached multiple times (currently, only the first time works, even by refreshing the page)
  • Anchor tags urls should be shareable (users should be capable of bookmarking/sharing URLs, in a way that the URL will lead them back directly to the anchor)

AFAIK, there two solutions currently that partially support those requirements: vue-router Scroll behavior that does not support first requirement in a robust manner, and vue-scrollto that does not support second requirement since it's just scrolling without any sense of routing/url.

What does the proposed API look like?

The API is already there, using the hash field

<router-link :to="{name: 'SomeVue', hash:'#anchor'}">Link to anchor</router-link>

// or

<a href="/somevue#anchor>Link to anchor</a>
<div id="anchor">Anchor</div>

We only need to implement the proper behavior for supporting use cases presented above.

@posva
Copy link
Member

posva commented Feb 26, 2018

Duplicate of #1668

@posva posva marked this as a duplicate of #1668 Feb 26, 2018
@posva posva closed this as completed Feb 26, 2018
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

2 participants