mirror of
https://github.com/tenrok/vue-form-wizard.git
synced 2026-06-09 00:02:24 +03:00
#114 Provide unique ids for steps and tabs without spaces
This commit is contained in:
@@ -232,7 +232,7 @@
|
||||
},
|
||||
addTab (item) {
|
||||
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)
|
||||
// if a step is added before the current one, go to it
|
||||
if (index < this.activeTabIndex + 1) {
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<template>
|
||||
<div v-show="active" class="wizard-tab-container"
|
||||
role="tabpanel"
|
||||
:id="title"
|
||||
:id="tabId"
|
||||
:aria-hidden="!active"
|
||||
:aria-labelledby="title">
|
||||
:aria-labelledby="`step-${tabId}`">
|
||||
<slot :active="active">
|
||||
</slot>
|
||||
</div>
|
||||
@@ -43,7 +43,8 @@
|
||||
return {
|
||||
active: false,
|
||||
validationError: null,
|
||||
checked: false
|
||||
checked: false,
|
||||
tabId: ''
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
<div class="wizard-icon-circle md"
|
||||
role="tab"
|
||||
:tabindex="tab.checked ? 0 : ''"
|
||||
:id="tab.tabId"
|
||||
:aria-controls="tab.title"
|
||||
:id="`step-${tab.tabId}`"
|
||||
:aria-controls="tab.tabId"
|
||||
:aria-disabled="tab.active"
|
||||
:aria-selected="tab.active"
|
||||
:class="{checked: tab.checked,square_shape:isStepSquare, tab_shape:isTabShape}"
|
||||
|
||||
Reference in New Issue
Block a user