Skip to content

Commit

Permalink
feat(DsfrDataTable): ♿ permet de parcourir les cellules au clavier
Browse files Browse the repository at this point in the history
et de copier le contenu de chaque cellule
  • Loading branch information
laruiss committed Sep 4, 2024
1 parent a5a1af4 commit ff8fc21
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/components/DsfrDataTable/DsfrDataTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,10 @@ function onPaginationOptionsChange () {
wholeSelection.value = false
selection.value.length = 0
}
function copyToClipboard (text) {
navigator.clipboard.writeText(text)
}
</script>

<template>
Expand Down Expand Up @@ -239,6 +243,9 @@ function onPaginationOptionsChange () {
<td
v-for="(cell, cellIdx) of row"
:key="typeof cell === 'object' ? cell[rowKey] : cell"
tabindex="0"
@keydown.ctrl.c="copyToClipboard(typeof cell === 'object' ? cell[rowKey] : cell)"
@keydown.meta.c="copyToClipboard(typeof cell === 'object' ? cell[rowKey] : cell)"
>
<slot
name="cell"
Expand Down

0 comments on commit ff8fc21

Please sign in to comment.