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 does not deactivate when route changes to a non-tabbed route #6505

Closed
randanunn opened this issue Feb 15, 2019 · 12 comments
Closed
Assignees
Labels
T: enhancement Functionality that enhances existing features
Milestone

Comments

@randanunn
Copy link

randanunn commented Feb 15, 2019

Versions and Environment

Vuetify: 1.5.1
Vue: 2.6.4
Browsers: Chrome 72.0.3626.109
OS: Mac OS 10.13.6

Steps to reproduce

Using vue-router and the :to parameter. Create a route in your app that is not available via v-tab. Navigate to it and see that the previously selected route/tab is still showing as active in the v-tab

Expected Behavior

De-activate tab if route does not match the tab.

Actual Behavior

Previously selected tab stays active even when route changes.

Reproduction Link

https://codepen.io/lucille2/pen/bzMmPQ

Other comments

In my app I use a v-toolbar header with tabs in the extension slot and an account menu in the main slot. The account menu can go to routes that are not available as tabs. But I cannot de-activate the v-tab when the user goes to one of those other routes. **Using vue-router

@randanunn
Copy link
Author

screen shot 2019-02-15 at 12 16 37 am

@johnleider johnleider added the maybe Functionality that we are considering label Feb 15, 2019
@johnleider johnleider added this to the v2.x.x milestone Feb 15, 2019
@lucafaggianelli
Copy link

I faced the same bug, is there a workaround to set the active tab? or somehow refresh vtabs?

@johnleider
Copy link
Member

I'm adding a new prop to help facilitate this functionality. Tabs by nature are mandatory which means that it expects to always have a value if it can have one. The new optional prop will allow the component to have no designated value.

tabs

@johnleider johnleider self-assigned this Feb 27, 2019
@johnleider johnleider added T: enhancement Functionality that enhances existing features and removed maybe Functionality that we are considering labels Feb 27, 2019
@johnleider johnleider modified the milestones: v2.x.x, v2.0.0 Feb 27, 2019
@randanunn
Copy link
Author

Awesome! Thanks John!

johnleider added a commit that referenced this issue Feb 27, 2019
determine if entered route does not match to existing tab and remove slider/active state

fixes #6505
@johnleider johnleider mentioned this issue Feb 27, 2019
8 tasks
johnleider added a commit that referenced this issue Mar 5, 2019
* feat(VTabs): initial conversion

* refactor(VTab): add value functionality from existing v-tab

* refactor(VTabs): improve styling, hook up existing functionality, fix slider

* feat(VTab): add hover/focus styles

* docs(Api): remove tabs color

* refactor(VTabs): improve a11y support

* docs(VTabs): update examples

* feat(VTabs): hookup existing functionality

* test(VTabs): move/rename unit tests

* test(VTab): fix unit tests

* test(VTabs): fix unit tests

* chore: remove deprecated files

* chore: cleanup/fix tests

* test(VTab): fix lint

* chore(VTabs): rename index to ts

* chore(VTabs): remove deprecated files

* refactor(VTabs): move height from tab to tab-bar

* fix(VTabs): reset slider if no active tab

BREAKING CHANGE: fixes #5636

* test(VTabs): fix tests

* fix(VTabs): move pseudo to :before

was making other items not clickable

* fix(VItemGroup): derive item index in real time

* chore(VTabs): add comments throughout

* refactor(VTabs): improve scroll arrow functionality

utilize existing computed property, updated tests to accommodate

* feat(VSlideGroup): add rtl support

resolves #6575

* fix(VTabs): add missing scroll into view functionality

fixes #5398

* fix(VTabs): use internalValue for tabs-bar and tabs-items

* fix(VTabsItems): set mandatory prop default false

handled by VTabsBar. If the mandatory value of bar/items are different, causes crash

* fix(VTabs): remove entry animation

* fix(VTabsBar): react to route changes

determine if entered route does not match to existing tab and remove slider/active state

fixes #6505

* docs(VTabs): update examples

* test(VItemGroup): fix test

* fix(VTabs): fix **fixed-tabs** styling

* fix(VTabs): spec improvements

should blur if mouse event similar to v-btn

* docs(VTabs): update examples

* refactor(VTabs): improve initial callSlider process

* fix(VTab): fix icon color with inactive

* refactor(VTabs): quality of live adjustments

* docs(VTabs): update/add more examples

* chore(VTabs): add missing prop language

* docs(VTabs): cleanup descriptions, improve examples

* fix(VTabs): propagate active-class to correct component

* fix(VTabs): apply correct margin with hidden slider

* feat(VTabs): add **vertical** support

resolves #3971

* style(VTabs.spec): fix lint

* style(VTabs): clean-up types

* refactor: simplify ternary

* style(VTab): remove useless code

* style(VWindowItem): clean-up types

* Update packages/vuetify/src/components/VTabs/VTabsBar.ts

Co-Authored-By: johnleider <john@vuetifyjs.com>

* style(VTabsBar): add Route type import

* fix(VTabs): add additional watchers

when grow and showArrows are toggled, should call slider

* style(VTab): use keyCodes util for keydown comparison

* fix(VTabs): rtl mode with **vertical** prop

* style(VTabs): split out variables

* fix(light.scss): use correct tabs color

* fix(VTab): horizontal alignment with **fixed-tabs** in IE11

* style(VTabsBar): improve typings

* docs(VTabs): improve example

* fix(VTabs): add missing disabled styles

* docs(VTabs): fix usage example

* docs(VTabs): fix dynamic example deprecations

* refactor(VTabsBar): apply local class to content for better style scoping

* fix(VTabs): add missing slider property

* style(VTabs): add comment explanations for genItems method

* style(VTabs): improve code readability

* refactor(VSlideGroup): rename prepend -> prev, append -> next to match rest of framework

* refactor(VTabs): change prop names for v-tabs-bar

* docs: update tabs kitchen

* fix(VTab): adjust font size to match spec

* fix(VSlideGroup): adjust flex-basis for prepend/append

* style(VTab): rename base class to **v-tab**

* style(VTabsBar): rename base class to **v-tabs-bar**

* style(VTabsSlider): rename base class to **v-tabs-slider**

* fix(VTab): adjust margin when inside of `v-toolbar`

fixes #4420
@johnleider
Copy link
Member

Fixed in f22d754

@dsldiesel
Copy link

Not working for me! V-tab item stays selected when navigating to a route that's not within tab route links.

@jacekkarczmarczyk
Copy link
Member

We kindly ask users to not comment on closed/resolved issues. If you believe that this issue has not been correctly resolved, please create a new issue showing the regression or reach out to us in our Discord community.

Thank you for your contribution and interest in improving Vuetify.

@randanunn
Copy link
Author

@dsldiesel you have to set `:optional="true".

@dsldiesel
Copy link

Thanks @randanunn ,
But it sticks with selected state also binding it.
I don0t know what this is, it is inside a v-navigation-drawer, as follows:

<v-navigation-drawer
    :value="drawer"
    width="81px"
    disable-resize-watcher
    mobile-break-point="100"
    clipped
    left
    app
  >
    <v-tabs
      :optional="true"
      vertical
      mobile-break-point="100"
      active-class="blueActive"
    >
      <v-tab
        v-for="(button, index) in menu"
        :key="index"
        class="menuTab"
        :to="button.path"
      >
        <img
          :src="require('@/assets/img/menu/' + button.name + '.png')"
          :alt="button.alt"
        />
      </v-tab>

Anything weird?

@westlepor
Copy link

Hi
When optional is set as true, how can I hide slider bar?

@bpeab

This comment was marked as outdated.

@johnleider
Copy link
Member

We kindly ask users to not comment on closed/resolved issues. If you believe that this issue has not been correctly resolved, please create a new issue showing the regression or create a new discussion.

If you have any questions, please reach out to us in our Discord community.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T: enhancement Functionality that enhances existing features
Projects
None yet
Development

No branches or pull requests

7 participants