Title: [192065] trunk/Source/WebInspectorUI
Revision
192065
Author
[email protected]
Date
2015-11-05 11:35:22 -0800 (Thu, 05 Nov 2015)

Log Message

Web Inspector: ⌥⌘C sometimes ends ups up opening inspector without console prompt focused
https://bugs.webkit.org/show_bug.cgi?id=150916

Patch by Joseph Pecoraro <[email protected]> on 2015-11-05
Reviewed by Timothy Hatcher.

When first opening the inspector we hide the window until the document
is mostly ready / loaded. However once displaying the window WK2 would
set the initial focus, clearing what we already had and focusing the
first natural element (tabindex dictates the toolbar). Workaround this
by detecting when the document becomes visible and then focusing the
console prompt.

* UserInterface/Protocol/InspectorFrontendAPI.js:
(InspectorFrontendAPI.showConsole):
(InspectorFrontendAPI.handleEvent):

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (192064 => 192065)


--- trunk/Source/WebInspectorUI/ChangeLog	2015-11-05 19:31:35 UTC (rev 192064)
+++ trunk/Source/WebInspectorUI/ChangeLog	2015-11-05 19:35:22 UTC (rev 192065)
@@ -1,5 +1,23 @@
 2015-11-05  Joseph Pecoraro  <[email protected]>
 
+        Web Inspector: ⌥⌘C sometimes ends ups up opening inspector without console prompt focused
+        https://bugs.webkit.org/show_bug.cgi?id=150916
+
+        Reviewed by Timothy Hatcher.
+
+        When first opening the inspector we hide the window until the document
+        is mostly ready / loaded. However once displaying the window WK2 would
+        set the initial focus, clearing what we already had and focusing the
+        first natural element (tabindex dictates the toolbar). Workaround this
+        by detecting when the document becomes visible and then focusing the
+        console prompt.
+
+        * UserInterface/Protocol/InspectorFrontendAPI.js:
+        (InspectorFrontendAPI.showConsole):
+        (InspectorFrontendAPI.handleEvent):
+
+2015-11-05  Joseph Pecoraro  <[email protected]>
+
         Web Inspector: Toolbar "Inspect Node" button not highlighting when active
         https://bugs.webkit.org/show_bug.cgi?id=150938
 

Modified: trunk/Source/WebInspectorUI/UserInterface/Protocol/InspectorFrontendAPI.js (192064 => 192065)


--- trunk/Source/WebInspectorUI/UserInterface/Protocol/InspectorFrontendAPI.js	2015-11-05 19:31:35 UTC (rev 192064)
+++ trunk/Source/WebInspectorUI/UserInterface/Protocol/InspectorFrontendAPI.js	2015-11-05 19:35:22 UTC (rev 192065)
@@ -74,15 +74,18 @@
         // If the page is still loading, focus the quick console again after tabindex autofocus.
         if (document.readyState !== "complete")
             document.addEventListener("readystatechange", this);
+        if (document.visibilityState !== "visible")
+            document.addEventListener("visibilitychange", this);  
     },
 
     handleEvent: function(event)
     {
-        console.assert(event.type === "readystatechange");
+        console.assert(event.type === "readystatechange" || event.type === "visibilitychange");
 
-        if (document.readyState === "complete") {
+        if (document.readyState === "complete" && document.visibilityState === "visible") {
             WebInspector.quickConsole.prompt.focus();
             document.removeEventListener("readystatechange", this);
+            document.removeEventListener("visibilitychange", this);
         }
     },
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to