Skip to content

Commit

Permalink
fix(VChip): add close button aria-label (#12384)
Browse files Browse the repository at this point in the history
  • Loading branch information
jyburns committed Nov 10, 2020
1 parent 8c5ee02 commit 9cd505d
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/api-generator/.gitignore
@@ -1,3 +1,3 @@
/dist/
/src/locale/*
!/src/en
!/src/locale/en
1 change: 1 addition & 0 deletions packages/api-generator/src/locale/en/v-chip.json
Expand Up @@ -3,6 +3,7 @@
"active": "Determines whether the chip is visible or not.",
"close": "Adds remove button",
"closeIcon": "Change the default icon used for **close** chips",
"closeLabel": "Text used for *aria-label* on the close button in **close** chips. Can also be customized globally in [Internationalization](/customization/internationalization).",
"disabled": "Disables the chip, making it un-selectable",
"draggable": "Makes the chip draggable",
"filter": "Displays a selection icon when selected",
Expand Down
7 changes: 7 additions & 0 deletions packages/vuetify/src/components/VChip/VChip.ts
Expand Up @@ -52,6 +52,10 @@ export default mixins(
type: String,
default: '$delete',
},
closeLabel: {
type: String,
default: '$vuetify.close',
},
disabled: Boolean,
draggable: Boolean,
filter: Boolean,
Expand Down Expand Up @@ -146,6 +150,9 @@ export default mixins(
right: true,
size: 18,
},
attrs: {
'aria-label': this.$vuetify.lang.t(this.closeLabel),
},
on: {
click: (e: Event) => {
e.stopPropagation()
Expand Down
7 changes: 7 additions & 0 deletions packages/vuetify/src/components/VChip/__tests__/VChip.spec.ts
Expand Up @@ -30,6 +30,13 @@ describe('VChip.ts', () => {
sync: false,
localVue,
router,
mocks: {
$vuetify: {
lang: {
t: (val: string) => val,
},
},
},
...options,
})
}
Expand Down
Expand Up @@ -4,6 +4,7 @@ exports[`VChip.ts should be removable 1`] = `
<span class="v-chip v-chip--no-color v-chip--removable theme--light v-size--default">
<span class="v-chip__content">
<button type="button"
aria-label="$vuetify.close"
class="v-icon notranslate v-chip__close v-icon--link v-icon--right material-icons theme--light"
style="font-size: 18px;"
>
Expand Down

0 comments on commit 9cd505d

Please sign in to comment.