Profiler: update start/stop to retain focus on press This CL updates both the start/stop button and the record icon to retain focus when pressed to start a profile for the memory or JavaScript Profiler tool. As part of starting a recording, the SDK ensures there are no other active profiles, and this triggers logic to disable the start button, causing focus to be lost before the button is re-enabled to allow users to stop recording. This CL ensures that the start/stop button or icon is re-focused at the end of the function to toggleRecording. Before: https://imgur.com/uQ77zH6 https://imgur.com/Lr47MtA After: https://imgur.com/z2FlHE6 https://imgur.com/O5B6e8D Bug: 963183 Change-Id: Idbbc4468ec738e0db16e44f22b89c9fa7c032db8 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/1983631 Reviewed-by: Robert Paveza <Rob.Paveza@microsoft.com> Commit-Queue: Brandon Goddard <brgoddar@microsoft.com>
diff --git a/front_end/profiler/ProfilesPanel.js b/front_end/profiler/ProfilesPanel.js index efa86fe..d92cd42 100644 --- a/front_end/profiler/ProfilesPanel.js +++ b/front_end/profiler/ProfilesPanel.js
@@ -176,6 +176,7 @@ if (!this._toggleRecordAction.enabled()) { return true; } + const toggleButton = this.element.ownerDocument.deepActiveElement(); const type = this._selectedProfileType; const isProfiling = type.buttonClicked(); this._updateToggleRecordAction(isProfiling); @@ -187,6 +188,9 @@ } else { this._launcherView.profileFinished(); } + if (toggleButton) { + toggleButton.focus(); + } return true; }