Skip to content

Commit b980017

Browse files
authored
fix(b-table): only set aria-describedby when caption really exists (#6251)
1 parent f2ffbeb commit b980017

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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy