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

fix(VWindow): fix wrong reverse animation logic for only 2 items #12685

Merged

Conversation

yuwu9145
Copy link
Member

@yuwu9145 yuwu9145 commented Nov 28, 2020

fixes #12672

Description

Issue #12672 is caused by a recent change from PR 12357. Its change results in wrong animation reverse logic when items length is less than 3.

This pull request is making it fully support all items length in terms of animation reverse logic on top of the code from PR 12357.

@nekosaur please help to check it out to see this change would raise any concerns from you and please also feel free to leave any feedback :).

Motivation and Context

closes #12672

How Has This Been Tested?

visually

Markup:

<template>
  <v-container>
    <v-card>
      <v-toolbar flat>
        <template v-slot:extension>
          <v-tabs
            v-model="tabs"
            fixed-tabs
          >
            <v-tabs-slider></v-tabs-slider>
            <v-tab
              href="#mobile-tabs-5-1"
              class="primary--text"
            >
              <v-icon>mdi-phone</v-icon>
            </v-tab>

            <v-tab
              href="#mobile-tabs-5-2"
              class="primary--text"
            >
              <v-icon>mdi-heart</v-icon>
            </v-tab>
          </v-tabs>
        </template>
      </v-toolbar>

      <v-tabs-items v-model="tabs">
        <v-tab-item
          v-for="i in 2"
          :key="i"
          :value="'mobile-tabs-5-' + i"
        >
          <v-card flat>
            <v-card-text v-text="text"></v-card-text>
          </v-card>
        </v-tab-item>
      </v-tabs-items>
    </v-card>
  </v-container>
</template>

<script>
  export default {
    data () {
      return {
        tabs: null,
        text: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.',
      }
    },
    methods: {
    }
  }
</script>

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Improvement/refactoring (non-breaking change that doesn't add any features but makes things better)

Checklist:

  • The PR title is no longer than 64 characters.
  • The PR is submitted to the correct branch (master for bug fixes and documentation updates, dev for new features and backwards compatible changes and next for non-backwards compatible changes).
  • My code follows the code style of this project.
  • I've added relevant changes to the documentation (applies to new features and breaking changes in core library)

const itemsLength = this.items.length
const lastIndex = itemsLength - 1

if (itemsLength <= 2) return val < oldVal
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nekosaur , please help to check if this change is compatible with fixing issue #11280 from this PR.

Thank you in advance :)

@yuwu9145 yuwu9145 changed the title Fix(vTabsItems): fix wrong reverse animation logic for only 2 items Fix(VWindow): fix wrong reverse animation logic for only 2 items Nov 30, 2020
@MajesticPotatoe MajesticPotatoe added C: VTabs VTabs T: bug Functionality that does not work as intended/expected labels Dec 1, 2020
@MajesticPotatoe MajesticPotatoe changed the title Fix(VWindow): fix wrong reverse animation logic for only 2 items fix(VWindow): fix wrong reverse animation logic for only 2 items Dec 1, 2020
@yuwu9145
Copy link
Member Author

yuwu9145 commented Dec 4, 2020

@MajesticPotatoe @nekosaur , I checked out myself, this PR respects the fix for this issue from PR 12357

Copy link
Member

@MajesticPotatoe MajesticPotatoe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍
Thank you for your contribution and interest in improving Vuetify! Make sure to join us in the Discord community.

@MajesticPotatoe MajesticPotatoe merged commit be00b92 into vuetifyjs:master Dec 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: VTabs VTabs T: bug Functionality that does not work as intended/expected
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug Report] Two tabs transition reversed
2 participants