diff --git a/Lib/profiling/sampling/_heatmap_assets/heatmap.css b/Lib/profiling/sampling/_heatmap_assets/heatmap.css index b5aa828c99c3e0..dfb6fd69b40ee6 100644 --- a/Lib/profiling/sampling/_heatmap_assets/heatmap.css +++ b/Lib/profiling/sampling/_heatmap_assets/heatmap.css @@ -682,6 +682,10 @@ opacity: 0.85; } +.toggle-switch:focus-visible { + border-radius: 4px; +} + .toggle-switch .toggle-label { font-size: 11px; font-weight: 500; diff --git a/Lib/profiling/sampling/_heatmap_assets/heatmap.js b/Lib/profiling/sampling/_heatmap_assets/heatmap.js index 9cedb2d84698b6..038aa44b3df619 100644 --- a/Lib/profiling/sampling/_heatmap_assets/heatmap.js +++ b/Lib/profiling/sampling/_heatmap_assets/heatmap.js @@ -733,7 +733,7 @@ function toggleAllBytecode() { } } -// Keyboard shortcut: 'b' toggles all bytecode panels +// Keyboard shortcut: 'b' toggles all bytecode panels, Enter/Space activates toggle switches document.addEventListener('keydown', function(e) { if (e.target.tagName === 'INPUT' || e.target.tagName === 'TEXTAREA') { return; @@ -741,6 +741,10 @@ document.addEventListener('keydown', function(e) { if (e.key === 'b' && !e.ctrlKey && !e.altKey && !e.metaKey) { toggleAllBytecode(); } + if ((e.key === 'Enter' || e.key === ' ') && e.target.classList.contains('toggle-switch')) { + e.preventDefault(); + e.target.click(); + } }); // Handle hash changes diff --git a/Lib/profiling/sampling/_heatmap_assets/heatmap_pyfile_template.html b/Lib/profiling/sampling/_heatmap_assets/heatmap_pyfile_template.html index 3d857c49d27962..3fb6d3a6b91dbb 100644 --- a/Lib/profiling/sampling/_heatmap_assets/heatmap_pyfile_template.html +++ b/Lib/profiling/sampling/_heatmap_assets/heatmap_pyfile_template.html @@ -70,17 +70,17 @@
-
+
Self Time
Total Time
-
+
Show All
Hot Only
-
+
Heat
Specialization diff --git a/Lib/profiling/sampling/_shared_assets/base.css b/Lib/profiling/sampling/_shared_assets/base.css index 46916709f19f54..c88cf58eef9260 100644 --- a/Lib/profiling/sampling/_shared_assets/base.css +++ b/Lib/profiling/sampling/_shared_assets/base.css @@ -387,6 +387,7 @@ body { button:focus-visible, select:focus-visible, input:focus-visible, +.toggle-switch:focus-visible, a.toolbar-btn:focus-visible { outline: 2px solid var(--python-gold); outline-offset: 2px;