8000 fix(b-table): only set `aria-describedby` when caption really exists (closes #6250) by jacobmllr95 · Pull Request #6251 · bootstrap-vue/bootstrap-vue · GitHub
[go: up one dir, main page]

Skip to content

fix(b-table): only set aria-describedby when caption really exists (closes #6250) #6251

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions src/components/table/helpers/mixin-caption.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ export const captionMixin = Vue.extend({
props,
computed: {
captionId() {
// Even though `this.safeId` looks like a method, it is a computed prop
// that returns a new function if the underlying ID changes
return this.isStacked ? this.safeId('_caption_') : null
}
},
Expand All @@ -38,7 +36,8 @@ export const captionMixin = Vue.extend({
{
attrs: { id: this.captionId },
domProps: hasCaptionSlot ? {} : htmlOrText(captionHtml, caption),
key: 'caption'
key: 'caption',
ref: 'caption'
},
this.normalizeSlot(SLOT_NAME_TABLE_CAPTION)
)
Expand Down
9 changes: 3 additions & 6 deletions src/components/table/helpers/mixin-table-renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,17 +113,14 @@ export const tableRendererMixin = Vue.extend({
selectableTableAttrs
} = this

// Preserve user supplied aria-describedby, if provided in `$attrs`
const adb =
[(this.bvAttrs || {})['aria-describedby'], this.captionId].filter(identity).join(' ') ||
null

const ariaAttrs = this.isTableSimple
? {}
: {
'aria-busy': this.computedBusy ? 'true' : 'false',
'aria-colcount': toString(fields.length),
'aria-describedby': adb
// Preserve user supplied `aria-describedby`, if provided
'aria-describedby':
this.bvAttrs['aria-describedby'] || this.$refs.caption ? this.captionId : null
}

const rowCount =
Expand Down
0