Commit f8790ba9 authored by eric@webkit.org's avatar eric@webkit.org
Browse files

2010-05-19 Andrey Kosyakov <caseq@chromium.org>

        Reviewed by Timothy Hatcher.

        Maintain focus on help screen while it's active.
        https://bugs.webkit.org/show_bug.cgi?id=39237

        * inspector/front-end/HelpScreen.js:
        (WebInspector.HelpScreen):
        (WebInspector.HelpScreen.prototype.show):
        (WebInspector.HelpScreen.prototype._hide):
        (WebInspector.HelpScreen.prototype._onBlur):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@59816 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 44620eae
2010-05-19 Andrey Kosyakov <caseq@chromium.org>
Reviewed by Timothy Hatcher.
Maintain focus on help screen while it's active.
https://bugs.webkit.org/show_bug.cgi?id=39237
* inspector/front-end/HelpScreen.js:
(WebInspector.HelpScreen):
(WebInspector.HelpScreen.prototype.show):
(WebInspector.HelpScreen.prototype._hide):
(WebInspector.HelpScreen.prototype._onBlur):
2010-05-19 Jedrzej Nowacki <jedrzej.nowacki@nokia.com>
 
Reviewed by Kenneth Rohde Christiansen.
......@@ -41,6 +41,7 @@ WebInspector.HelpScreen = function(title)
var closeButton = captionWindow.createChild("button", "help-close-button");
this.contentElement = mainWindow.createChild("div", "help-content");
this.contentElement.tabIndex = 0;
this.contentElement.addEventListener("blur", this._onBlur.bind(this), false);
captionWindow.createChild("h1", "help-window-title").innerText = title;
closeButton.innerText = "\u2716"; // Code stands for HEAVY MULTIPLICATION X.
......@@ -56,15 +57,20 @@ WebInspector.HelpScreen = function(title)
WebInspector.HelpScreen.prototype = {
show: function()
{
if (this._isShown)
return;
this._element.style.visibility = "visible";
this._isShown = true;
this.contentElement.focus();
this._previousFocusElement = WebInspector.currentFocusElement;
WebInspector.currentFocusElement = this.contentElement;
},
_hide: function()
{
this._isShown = false;
this._element.style.visibility = "hidden";
WebInspector.currentFocusElement = this._previousFocusElement;
},
_onKeyDown: function(event)
......@@ -75,6 +81,13 @@ WebInspector.HelpScreen.prototype = {
}
},
_onBlur: function()
{
// Pretend we're modal, grab focus back if we're still shown.
if (this._isShown)
WebInspector.currentFocusElement = this.contentElement;
},
_addStyleSheetIfNeeded: function(href)
{
if (WebInspector.HelpScreen._styleSheetAdded)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment