Skip to content

Commit f6f73c7

Browse files
authored
feat(b-table, b-table-lite): use aria-details rather than aria-describedby when details row showing (addresses #3801) (#3992)
1 parent 444d8b0 commit f6f73c7

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/components/table/helpers/mixin-tbody-row.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,9 @@ export default {
228228
// We can return more than one TR if rowDetails enabled
229229
const $rows = []
230230

231-
// Details ID needed for aria-describedby when details showing
231+
// Details ID needed for `aria-details` when details showing
232+
// We set it to `null` when not showing so that attribute
233+
// does not appear on the element
232234
const detailsId = rowShowDetails ? this.safeId(`_details_${rowIndex}_`) : null
233235

234236
// For each item data field in row
@@ -284,7 +286,7 @@ export default {
284286
tabindex: hasRowClickHandler ? '0' : null,
285287
'data-pk': rowId ? String(item[primaryKey]) : null,
286288
// Should this be `aria-details` instead?
287-
'aria-describedby': detailsId,
289+
'aria-details': detailsId,
288290
'aria-owns': detailsId,
289291
'aria-rowindex': ariaRowIndex,
290292
...selectableAttrs
@@ -322,7 +324,7 @@ export default {
322324
}
323325

324326
// Render the details slot in a TD
325-
const $details = h(BTd, { props: { colspan: fields.length }, attrs: { id: detailsId } }, [
327+
const $details = h(BTd, { props: { colspan: fields.length } }, [
326328
this.normalizeSlot(detailsSlotName, detailsScope)
327329
])
328330

@@ -351,7 +353,7 @@ export default {
351353
: this.tbodyTrClass
352354
],
353355
props: { variant: item._rowVariant || null },
354-
attrs: { id: detailsId }
356+
attrs: { id: detailsId, tabindex: '-1' }
355357
},
356358
[$details]
357359
)

0 commit comments

Comments
 (0)