Web Inspector: Escape in global search field should clear it
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 13 Sep 2017 20:24:55 +0000 (20:24 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 13 Sep 2017 20:24:55 +0000 (20:24 +0000)
https://bugs.webkit.org/show_bug.cgi?id=176764

Patch by Joseph Pecoraro <pecoraro@apple.com> on 2017-09-13
Reviewed by Timothy Hatcher.

* UserInterface/Views/QuickConsole.js:
(WI.QuickConsole.prototype._toggleOrFocus):
Don't implicitly prevent default. So if we didn't cause an action we
can let the default system action happen.

* UserInterface/Views/SearchBar.js:
(WI.SearchBar):
Remove unused keyboard shortcuts.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@221990 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebInspectorUI/ChangeLog
Source/WebInspectorUI/UserInterface/Views/QuickConsole.js
Source/WebInspectorUI/UserInterface/Views/SearchBar.js

index 5d76838..2895c34 100644 (file)
@@ -1,3 +1,19 @@
+2017-09-13  Joseph Pecoraro  <pecoraro@apple.com>
+
+        Web Inspector: Escape in global search field should clear it
+        https://bugs.webkit.org/show_bug.cgi?id=176764
+
+        Reviewed by Timothy Hatcher.
+
+        * UserInterface/Views/QuickConsole.js:
+        (WI.QuickConsole.prototype._toggleOrFocus):
+        Don't implicitly prevent default. So if we didn't cause an action we
+        can let the default system action happen.
+
+        * UserInterface/Views/SearchBar.js:
+        (WI.SearchBar):
+        Remove unused keyboard shortcuts.
+
 2017-09-12  Joseph Pecoraro  <pecoraro@apple.com>
 
         Web Inspector: Add Experimental setting for new Network tab
index 8d5d628..cf1bf72 100644 (file)
@@ -30,6 +30,7 @@ WI.QuickConsole = class QuickConsole extends WI.View
         super(element);
 
         this._toggleOrFocusKeyboardShortcut = new WI.KeyboardShortcut(null, WI.KeyboardShortcut.Key.Escape, this._toggleOrFocus.bind(this));
+        this._toggleOrFocusKeyboardShortcut.implicitlyPreventsDefault = false;
 
         this._mainExecutionContextPathComponent = this._createExecutionContextPathComponent(WI.mainTarget.executionContext);
 
@@ -330,10 +331,13 @@ WI.QuickConsole = class QuickConsole extends WI.View
 
     _toggleOrFocus(event)
     {
-        if (this.prompt.focused)
+        if (this.prompt.focused) {
             WI.toggleSplitConsole();
-        else if (!WI.isEditingAnyField() && !WI.isEventTargetAnEditableField(event))
+            event.preventDefault();
+        } else if (!WI.isEditingAnyField() && !WI.isEventTargetAnEditableField(event)) {
             this.prompt.focus();
+            event.preventDefault();
+        }
     }
 
     _updateStyles()
index b48b966..1b18cd3 100644 (file)
@@ -31,9 +31,6 @@ WI.SearchBar = class SearchBar extends WI.NavigationItem
 
         this._element.classList.add("search-bar");
 
-        this._keyboardShortcutEsc = new WI.KeyboardShortcut(null, WI.KeyboardShortcut.Key.Escape);
-        this._keyboardShortcutEnter = new WI.KeyboardShortcut(null, WI.KeyboardShortcut.Key.Enter);
-
         this._searchInput = this._element.appendChild(document.createElement("input"));
         this._searchInput.type = "search";
         this._searchInput.spellcheck = false;