From 887b45bd8b4b3282d3c595038cc49b3c483bd69f Mon Sep 17 00:00:00 2001 From: Connor Clark Date: Mon, 17 May 2021 15:33:57 -0700 Subject: [PATCH] misc(treemap): update colors on enter keypress --- lighthouse-treemap/app/src/main.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lighthouse-treemap/app/src/main.js b/lighthouse-treemap/app/src/main.js index ad169d8d3fc3..157e212e6e75 100644 --- a/lighthouse-treemap/app/src/main.js +++ b/lighthouse-treemap/app/src/main.js @@ -161,6 +161,12 @@ class TreemapViewer { this.updateColors(); }); + treemapEl.addEventListener('keypress', (e) => { + if (!(e instanceof KeyboardEvent)) return; + + if (e.key === 'Enter') this.updateColors(); + }); + treemapEl.addEventListener('mouseover', (e) => { if (!(e.target instanceof HTMLElement)) return; const nodeEl = e.target.closest('.webtreemap-node');