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

[Bug Report] V-tab achor hash doesn't update url #4784

Closed
amritk opened this issue Aug 2, 2018 · 5 comments
Closed

[Bug Report] V-tab achor hash doesn't update url #4784

amritk opened this issue Aug 2, 2018 · 5 comments
Labels
T: bug Functionality that does not work as intended/expected
Milestone

Comments

@amritk
Copy link
Contributor

amritk commented Aug 2, 2018

Versions and Environment

Vuetify: 1.1.9
Vue: 2.5.16
Browsers: Chrome 68.0.3440.75
OS: Ubuntu 18.04

Steps to reproduce

Use an href="#something" with the v-tab

Expected Behavior

It changes the tab as well as updates the url with the new hash

Actual Behavior

It changes the tab but does not update the url, nor does it load the correct tab if you manually type in the hash in the url.

Reproduction Link

https://codepen.io/amritk/pen/djeqBX


Additional Comments:

Can't really see the url changing in the codepen, not sure how to showcase that, but if you copy this code locally you should see that it doesn't change the url.

@amritk amritk changed the title V-tab achor hash doesn't update url [Bug Report] V-tab achor hash doesn't update url Aug 2, 2018
@amritk
Copy link
Contributor Author

amritk commented Aug 23, 2018

I tracked it down to this line in VTab.js line 75

if (this.href && this.href.indexOf('#') > -1) e.preventDefault();

If I comment it out, it works perfectly. Why is it preventing default on a hash fragment url?

    methods: {
        click: function click(e) {
            // If user provides an
            // actual link, do not
            // prevent default
            if (this.href && this.href.indexOf('#') > -1) e.preventDefault();
            this.$emit('click', e);
            this.to || this.tabClick(this);
        },

@amritk
Copy link
Contributor Author

amritk commented Aug 23, 2018

If it was to allow people to use a '#' by itself, can we not instead do

if (this.href && this.href === '#') e.preventDefault();

So this would work correctly:

<tab href="#teams">

And this would work as is:

<tab href="#">

@johnleider johnleider added the T: bug Functionality that does not work as intended/expected label Sep 15, 2018
@johnleider johnleider modified the milestones: v1.4.0, v1.3.0 Sep 15, 2018
@johnleider
Copy link
Member

Closed via #5124

@johnleider
Copy link
Member

I'm reverting this because it causes a bad user experience when using hrefs. After releasing we realized what its true purpose was.

@amritk
Copy link
Contributor Author

amritk commented Oct 11, 2018

Maybe we should update the docs to tell users to use router-link instead of an anchor for hash fragment tab routing?

@lock lock bot locked as resolved and limited conversation to collaborators Oct 11, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
T: bug Functionality that does not work as intended/expected
Projects
None yet
Development

No branches or pull requests

2 participants