diff --git a/package.json b/package.json index dfba805..7c10bc6 100644 --- a/package.json +++ b/package.json @@ -56,4 +56,4 @@ "d3-shape": "3", "d3-flextree": "2.1.2" } -} +} \ No newline at end of file diff --git a/src/d3-org-chart.js b/src/d3-org-chart.js index b94002e..26e9c4d 100644 --- a/src/d3-org-chart.js +++ b/src/d3-org-chart.js @@ -1091,7 +1091,12 @@ export class OrgChart { selector: "node-button-g", data: (d) => [d] }) - .on("click", (event, d) => this.onButtonClick(event, d)); + .on("click", (event, d) => this.onButtonClick(event, d)) + .on("keydown", (event, d) => { + if (event.key === 'Enter' || event.key === ' ' || event.key === 'Spacebar') { + this.onButtonClick(event, d) + } + }); nodeButtonGroups.patternify({ tag: 'rect',