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] Tabs slider not showing #11558

Closed
ThomasKientz opened this issue Jun 4, 2020 · 2 comments
Closed

[Bug Report] Tabs slider not showing #11558

ThomasKientz opened this issue Jun 4, 2020 · 2 comments
Labels
C: VTabs VTabs duplicate The issue has already been reported

Comments

@ThomasKientz
Copy link
Contributor

Environment

Vuetify Version: 2.2.32
Vue Version: 2.6.11
Browsers: Chrome 83.0.4103.61
OS: Mac OS 10.15.3

Steps to reproduce

  1. Hide a VTabs with v-show
  2. Show the Vtabs

Expected Behavior

The tab slider to be visible.

Actual Behavior

Tab slider is not visible until we click on a tab.

Reproduction Link

https://codepen.io/thomaskientz/pen/JjGoGOq

@ghost ghost added the S: triage label Jun 4, 2020
@gmeral
Copy link

gmeral commented Sep 8, 2020

Looks like this issue is already known by the maintainers but no fix is planned as far as i know :
#11206
#4733

Had the same problem and used the IntersectionObserver to observe the tabs visibility and forcing the slider to appear as a workaround :
Put a ref on VTabs

<v-tabs v-model="selectedTab" ref="tabs">

Call this in mounted

observeVisibility() {
      var element = this.$refs.tabs.$el
      if (window.IntersectionObserver) {
        this.intersectionObserver = new IntersectionObserver((entries) => {
          if (entries[0].intersectionRatio) {
            // There is an intersection, the content is visible
            // Manually calling VTabs onResize method to properly show the slider
            this.$refs.tabs.onResize()
          }
        }, {
          root: document.body
        })
        this.intersectionObserver.observe(element)
      }
    },

Don't forget to stop the observer in beforeDestroy :

unObserveVisibility() {
      if (this.intersectionObserver) {
        this.intersectionObserver.disconnect()
      }
    }

@jacekkarczmarczyk
Copy link
Member

jacekkarczmarczyk commented Sep 8, 2020

Duplicate of #4733

EDIT; run this.$refs.tabs.callSlider() after showing tabs

@jacekkarczmarczyk jacekkarczmarczyk marked this as a duplicate of #4733 Sep 8, 2020
@jacekkarczmarczyk jacekkarczmarczyk added C: VTabs VTabs duplicate The issue has already been reported and removed S: triage labels Sep 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: VTabs VTabs duplicate The issue has already been reported
Projects
None yet
Development

No branches or pull requests

3 participants