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

anchor won't work when anchor/link's href is a complete link (/somepath#id) #8808

Closed
jjzhangg opened this issue Jan 3, 2018 · 2 comments
Closed
Assignees
Labels

Comments

@jjzhangg
Copy link
Contributor

@jjzhangg jjzhangg commented Jan 3, 2018

Version

3.1.0

Environment

any

Reproduction link

https://codesandbox.io/s/o97wp51vmq

Steps to reproduce

just scroll page

What is expected?

some link of the anchor being active

What is actually happening?

none link being active


We introduced base tag in our html
<head><base href="/somebase">...<head>
and with this setting, every #id, will be translated by browser into /somebase#id, not document.href#id. As a result, we need to specify anchor/link href as complete link.
But the current code of anchor, take href as #id by default, and will not work with a complete link like '/hello/world#id'.

@ant-design-bot
Copy link
Contributor

@ant-design-bot ant-design-bot commented Jan 3, 2018

It will be better to write your issue/comment in English, so more people can understand you.
And this means that more people can help you or benefit from your issue/comment.
See: #4897

@jjzhangg jjzhangg changed the title anchor无法支持href为完整url的情况 anchor won't work when anchor/link's href is a complete link (/somepath#id) Jan 3, 2018
@dengfuping
Copy link
Contributor

@dengfuping dengfuping commented Jan 3, 2018

@jjzhangg The problem exists indeed when opened in codesandbox. But it's all right in codepen and riddle.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

4 participants