Commit 4de08c36 authored by Erik Luo's avatar Erik Luo Committed by Commit Bot

DevTools: do not increment on Arrow when showing SuggestBox

When SuggestBox is open, ArrowUp/Down should move vertically among
suggestions. Before, it might increment numerical values.

Bug: none
Change-Id: Ic0ede8ddca09818cd850be5bef06a8e685018dd0
Reviewed-on: https://chromium-review.googlesource.com/c/1258203Reviewed-by: default avatarJoel Einbinder <einbinder@chromium.org>
Commit-Queue: Erik Luo <luoe@chromium.org>
Cr-Commit-Position: refs/heads/master@{#596062}
parent 008d7ab2
......@@ -2107,7 +2107,7 @@ Elements.StylesSidebarPane.CSSPropertyPrompt = class extends UI.TextPrompt {
case 'ArrowDown':
case 'PageUp':
case 'PageDown':
if (this._handleNameOrValueUpDown(event)) {
if (!this.isSuggestBoxVisible() && this._handleNameOrValueUpDown(event)) {
event.preventDefault();
return;
}
......
......@@ -274,7 +274,7 @@ UI.TextPrompt = class extends Common.Object {
*/
onKeyDown(event) {
let handled = false;
if (this._isSuggestBoxVisible() && this._suggestBox.keyPressed(event)) {
if (this.isSuggestBoxVisible() && this._suggestBox.keyPressed(event)) {
event.consume(true);
return;
}
......@@ -299,7 +299,7 @@ UI.TextPrompt = class extends Common.Object {
this.clearAutocomplete();
break;
case 'Escape':
if (this._isSuggestBoxVisible()) {
if (this.isSuggestBoxVisible()) {
this.clearAutocomplete();
handled = true;
}
......@@ -338,7 +338,7 @@ UI.TextPrompt = class extends Common.Object {
*/
acceptAutoComplete() {
let result = false;
if (this._isSuggestBoxVisible())
if (this.isSuggestBoxVisible())
result = this._suggestBox.acceptSuggestion();
if (!result)
result = this._acceptSuggestionInternal();
......@@ -349,7 +349,7 @@ UI.TextPrompt = class extends Common.Object {
clearAutocomplete() {
const beforeText = this.textWithCurrentSuggestion();
if (this._isSuggestBoxVisible())
if (this.isSuggestBoxVisible())
this._suggestBox.hide();
this._clearAutocompleteTimeout();
this._queryRange = null;
......@@ -382,7 +382,7 @@ UI.TextPrompt = class extends Common.Object {
* @param {boolean=} force
*/
autoCompleteSoon(force) {
const immediately = this._isSuggestBoxVisible() || force;
const immediately = this.isSuggestBoxVisible() || force;
if (!this._completeTimeout) {
this._completeTimeout =
setTimeout(this.complete.bind(this, force), immediately ? 0 : this._autocompletionTimeout);
......@@ -401,7 +401,7 @@ UI.TextPrompt = class extends Common.Object {
let shouldExit;
if (!force && !this._isCaretAtEndOfPrompt() && !this._isSuggestBoxVisible())
if (!force && !this._isCaretAtEndOfPrompt() && !this.isSuggestBoxVisible())
shouldExit = true;
else if (!selection.isCollapsed)
shouldExit = true;
......@@ -565,9 +565,10 @@ UI.TextPrompt = class extends Common.Object {
}
/**
* @protected
* @return {boolean}
*/
_isSuggestBoxVisible() {
isSuggestBoxVisible() {
return this._suggestBox && this._suggestBox.visible();
}
......
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