Commit 31bd1fb4 authored by Brandon Goddard's avatar Brandon Goddard Committed by Commit Bot

Devtools: Keyboard Nav fix for Profiler Panels

This change scopes down a keydown listener in Profiler panels (Memory
and Javascript Profiler tools) so that it only applies to the sidebar
tree element that the handler manipulates (selecting which profile to
view).

Previously, any up/down arrow press that was not handled in the entire
panel could result in the change in view. For example, with focus
on the toolbar dropdown, pressing the down arrow would change the
perspective as desired, but pressing up would move back to the start
screen by changing the element selected (shown in the before gif below).

Now the arrows navigate to the different snapshots/etc only when the
sidebar has focus.

Before: https://imgur.com/cWO43Tp

After: https://imgur.com/03gReuM

Bug: 963183
Change-Id: Ie2337449c064b8e3d690dc2cb0ef07be296c798e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1775055Reviewed-by: default avatarErik Luo <luoe@chromium.org>
Commit-Queue: Brandon Goddard <brgoddar@microsoft.com>
Cr-Commit-Position: refs/heads/master@{#695222}
parent 23bc9e7c
......@@ -52,6 +52,8 @@ Profiler.ProfilesPanel = class extends UI.PanelWithSidebar {
this._sidebarTree.appendChild(this.profilesItemTreeElement);
this._sidebarTree.element.addEventListener('keydown', this._onKeyDown.bind(this), false);
this.profileViews = createElement('div');
this.profileViews.id = 'profile-views';
this.profileViews.classList.add('vbox');
......@@ -95,8 +97,6 @@ Profiler.ProfilesPanel = class extends UI.PanelWithSidebar {
this._createFileSelectorElement();
this.element.addEventListener('contextmenu', this._handleContextMenuEvent.bind(this), false);
this.contentElement.addEventListener('keydown', this._onKeyDown.bind(this), false);
SDK.targetManager.addEventListener(SDK.TargetManager.Events.SuspendStateChanged, this._onSuspendStateChanged, this);
UI.context.addFlavorChangeListener(SDK.CPUProfilerModel, this._updateProfileTypeSpecificUI, this);
UI.context.addFlavorChangeListener(SDK.HeapProfilerModel, this._updateProfileTypeSpecificUI, this);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment