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(VStepperStep): editable step tab navigation #14036

Merged
merged 2 commits into from
Dec 7, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 13 additions & 2 deletions packages/vuetify/src/components/VStepper/VStepperStep.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export default baseMixins.extend<options>().extend({
},

methods: {
click (e: MouseEvent) {
click (e: MouseEvent | KeyboardEvent) {
e.stopPropagation()

this.$emit('click', e)
Expand Down Expand Up @@ -131,6 +131,11 @@ export default baseMixins.extend<options>().extend({

return children
},
keyboardClick (e: KeyboardEvent) {
if (e.keyCode === 32) {
johnleider marked this conversation as resolved.
Show resolved Hide resolved
this.click(e)
}
},
toggle (step: number | string) {
this.isActive = step.toString() === this.step.toString()
this.isInactive = Number(step) < Number(this.step)
Expand All @@ -139,13 +144,19 @@ export default baseMixins.extend<options>().extend({

render (h): VNode {
return h('div', {
attrs: {
tabindex: this.editable ? 0 : -1,
},
staticClass: 'v-stepper__step',
class: this.classes,
directives: [{
name: 'ripple',
value: this.editable,
}],
on: { click: this.click },
on: {
click: this.click,
keydown: this.keyboardClick,
},
}, [
this.genStep(),
this.genLabel(),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`VStepperStep.ts should accept a custom color 1`] = `
<div class="v-stepper__step v-stepper__step--inactive v-stepper__step--complete">
<div tabindex="-1"
class="v-stepper__step v-stepper__step--inactive v-stepper__step--complete"
>
<span class="v-stepper__step__step pink">
<i aria-hidden="true"
class="v-icon notranslate mdi mdi-check theme--light"
Expand All @@ -14,7 +16,9 @@ exports[`VStepperStep.ts should accept a custom color 1`] = `
`;

exports[`VStepperStep.ts should accept a custom css color 1`] = `
<div class="v-stepper__step v-stepper__step--inactive v-stepper__step--complete">
<div tabindex="-1"
class="v-stepper__step v-stepper__step--inactive v-stepper__step--complete"
>
<span class="v-stepper__step__step"
style="background-color: rgb(170, 187, 204); border-color: #aabbcc;"
>
Expand All @@ -29,7 +33,9 @@ exports[`VStepperStep.ts should accept a custom css color 1`] = `
`;

exports[`VStepperStep.ts should render 1`] = `
<div class="v-stepper__step v-stepper__step--inactive">
<div tabindex="-1"
class="v-stepper__step v-stepper__step--inactive"
>
<span class="v-stepper__step__step">
1
</span>
Expand All @@ -39,7 +45,9 @@ exports[`VStepperStep.ts should render 1`] = `
`;

exports[`VStepperStep.ts should render complete step 1`] = `
<div class="v-stepper__step v-stepper__step--inactive v-stepper__step--complete">
<div tabindex="-1"
class="v-stepper__step v-stepper__step--inactive v-stepper__step--complete"
>
<span class="v-stepper__step__step primary">
<i aria-hidden="true"
class="v-icon notranslate mdi mdi-check theme--light"
Expand All @@ -52,7 +60,9 @@ exports[`VStepperStep.ts should render complete step 1`] = `
`;

exports[`VStepperStep.ts should render editable step 1`] = `
<div class="v-stepper__step v-stepper__step--editable v-stepper__step--inactive v-stepper__step--complete">
<div tabindex="0"
class="v-stepper__step v-stepper__step--editable v-stepper__step--inactive v-stepper__step--complete"
>
<span class="v-stepper__step__step primary">
<i aria-hidden="true"
class="v-icon notranslate material-icons theme--light"
Expand All @@ -66,7 +76,9 @@ exports[`VStepperStep.ts should render editable step 1`] = `
`;

exports[`VStepperStep.ts should render step with error 1`] = `
<div class="v-stepper__step v-stepper__step--inactive v-stepper__step--error error--text">
<div tabindex="-1"
class="v-stepper__step v-stepper__step--inactive v-stepper__step--error error--text"
>
<span class="v-stepper__step__step">
<i aria-hidden="true"
class="v-icon notranslate material-icons theme--light"
Expand Down