Web Inspector: clicking on the body of a CSS rule after editing the selector causes...
authorwebkit@devinrousso.com <webkit@devinrousso.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 4 Apr 2017 03:28:03 +0000 (03:28 +0000)
committerwebkit@devinrousso.com <webkit@devinrousso.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 4 Apr 2017 03:28:03 +0000 (03:28 +0000)
https://bugs.webkit.org/show_bug.cgi?id=169803

Reviewed by Timothy Hatcher.

* UserInterface/Views/CSSStyleDeclarationSection.js:
(WebInspector.CSSStyleDeclarationSection.prototype._handleKeyDown):
(WebInspector.CSSStyleDeclarationSection.prototype._handleBlur):
Keep the section marked as `_editorActive` if the action taken would still place focus
within the section (selector or properties).  Doing so will prevent it from being removed.

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

Source/WebInspectorUI/ChangeLog
Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationSection.js

index 22b5618..a4402a4 100644 (file)
@@ -1,3 +1,16 @@
+2017-04-03  Devin Rousso  <webkit@devinrousso.com>
+
+        Web Inspector: clicking on the body of a CSS rule after editing the selector causes the section to disappear
+        https://bugs.webkit.org/show_bug.cgi?id=169803
+
+        Reviewed by Timothy Hatcher.
+
+        * UserInterface/Views/CSSStyleDeclarationSection.js:
+        (WebInspector.CSSStyleDeclarationSection.prototype._handleKeyDown):
+        (WebInspector.CSSStyleDeclarationSection.prototype._handleBlur):
+        Keep the section marked as `_editorActive` if the action taken would still place focus
+        within the section (selector or properties).  Doing so will prevent it from being removed.
+
 2017-04-03  Brian Burg  <bburg@apple.com>
 
         Web Inspector: RTL: hierarchical path component labels should guess directionality based on content
index fb26f03..673de3c 100644 (file)
@@ -638,7 +638,8 @@ WebInspector.CSSStyleDeclarationSection = class CSSStyleDeclarationSection exten
     _handleKeyDown(event)
     {
         if (event.keyCode === WebInspector.KeyboardShortcut.Key.Enter.keyCode) {
-            this._selectorInput.blur();
+            event.preventDefault();
+            this.focus();
             return;
         }
 
@@ -679,7 +680,7 @@ WebInspector.CSSStyleDeclarationSection = class CSSStyleDeclarationSection exten
         this._highlightNodesWithSelector();
     }
 
-    _handleBlur()
+    _handleBlur(event)
     {
         this._hideDOMNodeHighlight();
 
@@ -690,6 +691,11 @@ WebInspector.CSSStyleDeclarationSection = class CSSStyleDeclarationSection exten
             return;
         }
 
+        if (event.relatedTarget.isDescendant(this.element)) {
+            this._editorActive = true;
+            this.focus();
+        }
+
         this._style.ownerRule.selectorText = newSelectorText;
     }