2
0
mirror of https://github.com/tenrok/vue-form-wizard.git synced 2026-06-23 09:00:33 +03:00

#114 Provide unique ids for steps and tabs without spaces

This commit is contained in:
cristijora
2017-11-28 17:11:10 +02:00
parent 407ee9769f
commit d11b5ed9cf
3 changed files with 7 additions and 6 deletions
+1 -1
View File
@@ -232,7 +232,7 @@
}, },
addTab (item) { addTab (item) {
const index = this.$slots.default.indexOf(item.$vnode) const index = this.$slots.default.indexOf(item.$vnode)
item.tabId = `t-${item.title.replace(/ /g, '')}${index}` item.tabId = `${item.title.replace(/ /g, '')}${index}`
this.tabs.splice(index, 0, item) this.tabs.splice(index, 0, item)
// if a step is added before the current one, go to it // if a step is added before the current one, go to it
if (index < this.activeTabIndex + 1) { if (index < this.activeTabIndex + 1) {
+4 -3
View File
@@ -1,9 +1,9 @@
<template> <template>
<div v-show="active" class="wizard-tab-container" <div v-show="active" class="wizard-tab-container"
role="tabpanel" role="tabpanel"
:id="title" :id="tabId"
:aria-hidden="!active" :aria-hidden="!active"
:aria-labelledby="title"> :aria-labelledby="`step-${tabId}`">
<slot :active="active"> <slot :active="active">
</slot> </slot>
</div> </div>
@@ -43,7 +43,8 @@
return { return {
active: false, active: false,
validationError: null, validationError: null,
checked: false checked: false,
tabId: ''
} }
}, },
computed: { computed: {
+2 -2
View File
@@ -4,8 +4,8 @@
<div class="wizard-icon-circle md" <div class="wizard-icon-circle md"
role="tab" role="tab"
:tabindex="tab.checked ? 0 : ''" :tabindex="tab.checked ? 0 : ''"
:id="tab.tabId" :id="`step-${tab.tabId}`"
:aria-controls="tab.title" :aria-controls="tab.tabId"
:aria-disabled="tab.active" :aria-disabled="tab.active"
:aria-selected="tab.active" :aria-selected="tab.active"
:class="{checked: tab.checked,square_shape:isStepSquare, tab_shape:isTabShape}" :class="{checked: tab.checked,square_shape:isStepSquare, tab_shape:isTabShape}"