Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3285255

Browse files
committed
fix(b-table): only set aria-describedby when caption really exists
1 parent f2ffbeb commit 3285255

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

src/components/table/helpers/mixin-caption.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@ export const captionMixin = Vue.extend({
2020
props,
2121
computed: {
2222
captionId() {
23-
// Even though `this.safeId` looks like a method, it is a computed prop
24-
// that returns a new function if the underlying ID changes
2523
return this.isStacked ? this.safeId('_caption_') : null
2624
}
2725
},
@@ -38,7 +36,8 @@ export const captionMixin = Vue.extend({
3836
{
3937
attrs: { id: this.captionId },
4038
domProps: hasCaptionSlot ? {} : htmlOrText(captionHtml, caption),
41-
key: 'caption'
39+
key: 'caption',
40+
ref: 'caption'
4241
},
4342
this.normalizeSlot(SLOT_NAME_TABLE_CAPTION)
4443
)

src/components/table/helpers/mixin-table-renderer.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -113,17 +113,14 @@ export const tableRendererMixin = Vue.extend({
113113
selectableTableAttrs
114114
} = this
115115

116-
// Preserve user supplied aria-describedby, if provided in `$attrs`
117-
const adb =
118-
[(this.bvAttrs || {})['aria-describedby'], this.captionId].filter(identity).join(' ') ||
119-
null
120-
121116
const ariaAttrs = this.isTableSimple
122117
? {}
123118
: {
124119
'aria-busy': this.computedBusy ? 'true' : 'false',
125120
'aria-colcount': toString(fields.length),
126-
'aria-describedby': adb
121+
// Preserve user supplied `aria-describedby`, if provided
122+
'aria-describedby':
123+
this.bvAttrs['aria-describedby'] || this.$refs.caption ? this.captionId : null
127124
}
128125

129126
const rowCount =

0 commit comments

Comments
 (0)