Open Scripts tab Open console Type something Press Ctrl+R (Cmd+R) to reload the page Console no longer has focus.
Created attachment 103643 [details] Patch
Comment on attachment 103643 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=103643&action=review > Source/WebCore/inspector/front-end/ElementsPanel.js:224 > + WebInspector.console.focusIfVisible(); It is somewhat controversial: this way user will need to return focus back to the DOM tree in order to use keyboard to navigate/edit DOM tree. Is there a user requests for this feature?
Comment on attachment 103643 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=103643&action=review > Source/WebCore/inspector/front-end/ConsoleView.js:302 > + if (this.toggleConsoleButton.toggled) Can we have ConsoleView listening to the navigation event and restore focus on it only if it was in the console before the navigation?
> Can we have ConsoleView listening to the navigation event and restore focus on it only if it was in the console before the navigation? This is my big request since I tried to use console and reloaded a page several times yesterday. I suggest that you try following the steps in the bug. Ideally, we should not manually manage focus at all. Today, upon page load (no matter whether user reloaded it from inspector or the page did it), we restore various selections in the tree outlines. These selections steal focus from the console should it be there. So I decided to restore it to console in case it was opened. (Opened console is a somewhat strong indication that it has user's focus). I can see the downside of it, but it is easily worked around via closing the console. Alternatively, I could make TreeElement's select not request focus. But in that case, with console closed, reloading the page on elements panel would remote focus from the tree. Remembering the focus owner view and restoring it after its re-population sounds like the right, but fairly long way to go. I can try doing that, but if I fail, I'm suggesting that we land this.
(In reply to comment #4) > > Can we have ConsoleView listening to the navigation event and restore focus on it only if it was in the console before the navigation? > > This is my big request since I tried to use console and reloaded a page several times yesterday. I suggest that you try following the steps in the bug. > > Ideally, we should not manually manage focus at all. Today, upon page load (no matter whether user reloaded it from inspector or the page did it), we restore various selections in the tree outlines. These selections steal focus from the console should it be there. So I decided to restore it to console in case it was opened. (Opened console is a somewhat strong indication that it has user's focus). I can see the downside of it, but it is easily worked around via closing the console. > > Alternatively, I could make TreeElement's select not request focus. But in that case, with console closed, reloading the page on elements panel would remote focus from the tree. Remembering the focus owner view and restoring it after its re-population sounds like the right, but fairly long way to go. I can try doing that, but if I fail, I'm suggesting that we land this. I think we can file a bug on preserving focused view and fix it in another change.
Created attachment 103760 [details] Patch
Comment on attachment 103760 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=103760&action=review Please make sure all usages and implementations of revealAndSelect has consistent signatures. > Source/WebCore/inspector/front-end/ElementsPanel.js:183 > + this.selectDOMNode(null); this.selectDOMNode(null, false); ? > Source/WebCore/inspector/front-end/ElementsTreeOutline.js:80 > + selectedDOMNode: function() Why is it not a getter? > Source/WebCore/inspector/front-end/ProfilesPanel.js:393 > + profile._profilesTreeElement.revealAndSelect(false); Remove the false parameter? > Source/WebCore/inspector/front-end/treeoutline.js:439 > +TreeOutline.prototype.revealAndSelect = function() Add omitFocus parameter?
(In reply to comment #7) > (From update of attachment 103760 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=103760&action=review > > Please make sure all usages and implementations of revealAndSelect has consistent signatures. > > > Source/WebCore/inspector/front-end/ElementsPanel.js:183 > > + this.selectDOMNode(null); > > this.selectDOMNode(null, false); ? > Done. > > Source/WebCore/inspector/front-end/ElementsTreeOutline.js:80 > > + selectedDOMNode: function() > > Why is it not a getter? > It used to be setSelectedDOMNode and I want to maintain their consistency. > > Source/WebCore/inspector/front-end/ProfilesPanel.js:393 > > + profile._profilesTreeElement.revealAndSelect(false); > > Remove the false parameter? > Done. > > Source/WebCore/inspector/front-end/treeoutline.js:439 > > +TreeOutline.prototype.revealAndSelect = function() > > Add omitFocus parameter? Done.
Committed r92956: <http://trac.webkit.org/changeset/92956>