Changeset 251958 in webkit


Ignore:
Timestamp:
Nov 1, 2019 5:19:13 PM (4 years ago)
Author:
Devin Rousso
Message:

Web Inspector: default to focusing the console prompt if no other content is focused after opening Web Inspector
https://bugs.webkit.org/show_bug.cgi?id=203743

Reviewed by Eric Carlson and Brian Burg.

  • UserInterface/Base/Main.js:

(WI.isContentAreaFocused): Added.
(WI.isConsoleFocused):
(WI._focusChanged):
(WI._restoreCookieForOpenTabs):

Location:
trunk/Source/WebInspectorUI
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebInspectorUI/ChangeLog

    r251933 r251958  
     12019-11-01  Devin Rousso  <drousso@apple.com>
     2
     3        Web Inspector: default to focusing the console prompt if no other content is focused after opening Web Inspector
     4        https://bugs.webkit.org/show_bug.cgi?id=203743
     5
     6        Reviewed by Eric Carlson and Brian Burg.
     7
     8        * UserInterface/Base/Main.js:
     9        (WI.isContentAreaFocused): Added.
     10        (WI.isConsoleFocused):
     11        (WI._focusChanged):
     12        (WI._restoreCookieForOpenTabs):
     13
    1142019-11-01  Nikita Vasilyev  <nvasilyev@apple.com>
    215
  • trunk/Source/WebInspectorUI/UserInterface/Base/Main.js

    r251922 r251958  
    934934};
    935935
     936WI.isContentAreaFocused = function()
     937{
     938    return WI._contentElement.contains(document.activeElement);
     939}
     940
    936941WI.isConsoleFocused = function()
    937942{
    938     return WI.quickConsole.prompt.focused;
     943    return !WI._didAutofocusConsolePrompt && WI.quickConsole.prompt.focused;
    939944};
    940945
     
    13751380WI._focusChanged = function(event)
    13761381{
     1382    WI._didAutofocusConsolePrompt = false;
     1383
    13771384    // Make a caret selection inside the focused element if there isn't a range selection and there isn't already
    13781385    // a caret selection inside. This is needed (at least) to remove caret from console when focus is moved.
     
    15491556        tabContentView.restoreStateFromCookie(restorationType);
    15501557    }
     1558
     1559    window.requestAnimationFrame(() => {
     1560        if (WI.isContentAreaFocused())
     1561            return;
     1562
     1563        WI.quickConsole.prompt.focus();
     1564        WI._didAutofocusConsolePrompt = true;
     1565    });
    15511566};
    15521567
Note: See TracChangeset for help on using the changeset viewer.