Skip to content

fix(VTabs): prevent selection of disabled tabs#14229

Merged
KaelWD merged 4 commits intovuetifyjs:masterfrom
eliamartani:fix/tab-disable-behavior
Oct 31, 2021
Merged

fix(VTabs): prevent selection of disabled tabs#14229
KaelWD merged 4 commits intovuetifyjs:masterfrom
eliamartani:fix/tab-disable-behavior

Conversation

@eliamartani
Copy link
Copy Markdown
Contributor

Description

The problem I found on codebase is that whenever a v-tab is disabled the event propagation still happens on child elements because of pointer-events loses its inheritance.

Proper way I found to fix this was by adding the subsequent child elements to its list by overriding others pointer-events that could appear, e.g. v-badge

fixes #13728

Motivation and Context

The change itself helps fixing an UI behavior (#13728)

How Has This Been Tested?

Tested by using it on Chrome 94, Firefox 92 and Safari 15

Markup:

Details
<template>
  <v-container>
    <v-tabs
      v-model="model"
      centered
      slider-color="yellow"
    >
      <v-tab
        v-for="i in 3"
        :key="i"
        :href="`#tab-${i}`"
      >
        Item {{ i }}
        <v-badge overlap>
          <template #badge>
            <v-icon>mdi-magnify</v-icon>
          </template>
          <v-icon>mdi-clipboard</v-icon>
        </v-badge>
      </v-tab>
    </v-tabs>
  </v-container>
</template>

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)

Copy link
Copy Markdown
Member

@KaelWD KaelWD left a comment

Choose a reason for hiding this comment

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

Disabled tabs can still be activated with the keyboard

@eliamartani
Copy link
Copy Markdown
Contributor Author

Hi @KaelWD, update the PR with a change at VTab.ts.

@glen-84 glen-84 added C: VTabs T: bug Functionality that does not work as intended/expected labels Oct 24, 2021
@KaelWD KaelWD changed the title fix(VTabs): Update pointer-events on disabled items fix(VTabs): prevent selection of disabled tabs Oct 31, 2021
@KaelWD KaelWD merged commit 13545ab into vuetifyjs:master Oct 31, 2021
@KaelWD KaelWD mentioned this pull request Apr 11, 2022
8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C: 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][2.5.1] Disabled V-Tab can be switched to by clicking on V-Badge or by placing focus on it with tab key and pressing enter

3 participants