Skip to content

Commit 7620472

Browse files
committed
feat(DsfrDataTable): ♿ permet de parcourir les cellules au clavier
et de copier le contenu de chaque cellule
1 parent 3600d48 commit 7620472

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/components/DsfrDataTable/DsfrDataTable.vue

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,10 @@ function onPaginationOptionsChange () {
139139
wholeSelection.value = false
140140
selection.value.length = 0
141141
}
142+
143+
function copyToClipboard (text) {
144+
navigator.clipboard.writeText(text)
145+
}
142146
</script>
143147

144148
<template>
@@ -240,6 +244,9 @@ function onPaginationOptionsChange () {
240244
<td
241245
v-for="(cell, cellIdx) of row"
242246
:key="typeof cell === 'object' ? cell[rowKey] : cell"
247+
tabindex="0"
248+
@keydown.ctrl.c="copyToClipboard(typeof cell === 'object' ? cell[rowKey] : cell)"
249+
@keydown.meta.c="copyToClipboard(typeof cell === 'object' ? cell[rowKey] : cell)"
243250
>
244251
<slot
245252
name="cell"

0 commit comments

Comments
 (0)