Skip to content
This repository has been archived by the owner on Jun 1, 2023. It is now read-only.

Commit

Permalink
#114 Provide unique ids for steps and tabs without spaces
Browse files Browse the repository at this point in the history
  • Loading branch information
cristijora committed Nov 28, 2017
1 parent 407ee97 commit d11b5ed
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/components/FormWizard.vue
Expand Up @@ -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) {
Expand Down
7 changes: 4 additions & 3 deletions src/components/TabContent.vue
@@ -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>
Expand Down Expand Up @@ -43,7 +43,8 @@
return {
active: false,
validationError: null,
checked: false
checked: false,
tabId: ''
}
},
computed: {
Expand Down
4 changes: 2 additions & 2 deletions src/components/WizardStep.vue
Expand Up @@ -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}"
Expand Down

0 comments on commit d11b5ed

Please sign in to comment.