mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-20 22:28:00 +01:00
Fix strictfocus edgecase when the content window is editable.
--HG-- branch : key-processing
This commit is contained in:
@@ -551,7 +551,7 @@ var Buffer = Module("buffer", {
|
|||||||
* @returns {boolean}
|
* @returns {boolean}
|
||||||
*/
|
*/
|
||||||
focusAllowed: function (elem) {
|
focusAllowed: function (elem) {
|
||||||
if (elem instanceof Window && !Editor.getEditor(window))
|
if (elem instanceof Window && !Editor.getEditor(elem))
|
||||||
return true;
|
return true;
|
||||||
let doc = elem.ownerDocument || elem.document || elem;
|
let doc = elem.ownerDocument || elem.document || elem;
|
||||||
return !options["strictfocus"] || doc.dactylFocusAllowed;
|
return !options["strictfocus"] || doc.dactylFocusAllowed;
|
||||||
|
|||||||
@@ -482,6 +482,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
|||||||
|
|
||||||
let win = document.commandDispatcher.focusedWindow;
|
let win = document.commandDispatcher.focusedWindow;
|
||||||
let elem = config.mainWidget || content;
|
let elem = config.mainWidget || content;
|
||||||
|
|
||||||
// TODO: make more generic
|
// TODO: make more generic
|
||||||
try {
|
try {
|
||||||
if (this.has("mail") && !config.isComposeWindow) {
|
if (this.has("mail") && !config.isComposeWindow) {
|
||||||
|
|||||||
@@ -960,32 +960,31 @@ var Events = Module("events", {
|
|||||||
// the main window does not restore focus and we lose key
|
// the main window does not restore focus and we lose key
|
||||||
// input.
|
// input.
|
||||||
services.focus.clearFocus(window);
|
services.focus.clearFocus(window);
|
||||||
document.commandDispatcher.focusedWindow = content;
|
document.commandDispatcher.focusedWindow = Editor.getEditor(content) ? window : content;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
// TODO: Merge with onFocusChange
|
// TODO: Merge with onFocusChange
|
||||||
focus: function onFocus(event) {
|
focus: function onFocus(event) {
|
||||||
let elem = event.originalTarget;
|
let elem = event.originalTarget;
|
||||||
if (elem instanceof Element) {
|
|
||||||
let win = elem.ownerDocument.defaultView;
|
|
||||||
|
|
||||||
if (event.target instanceof Ci.nsIDOMXULTextBoxElement)
|
if (event.target instanceof Ci.nsIDOMXULTextBoxElement)
|
||||||
for (let e = elem; e instanceof Element; e = e.parentNode)
|
for (let e = elem; e instanceof Element; e = e.parentNode)
|
||||||
if (util.computedStyle(e).visibility !== "visible" ||
|
if (util.computedStyle(e).visibility !== "visible" ||
|
||||||
e.boxObject && e.boxObject.height === 0) {
|
e.boxObject && e.boxObject.height === 0) {
|
||||||
elem.blur();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (events.isContentNode(elem) && !buffer.focusAllowed(elem)
|
|
||||||
&& !(services.focus.getLastFocusMethod(win) & 0x7000)
|
|
||||||
&& isinstance(elem, [HTMLInputElement, HTMLSelectElement, HTMLTextAreaElement, Window])) {
|
|
||||||
if (elem.frameElement)
|
|
||||||
dactyl.focusContent(true);
|
|
||||||
else if (!(elem instanceof Window) || Editor.getEditor(elem))
|
|
||||||
elem.blur();
|
elem.blur();
|
||||||
}
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
let win = (elem.ownerDocument || elem).defaultView || elem;
|
||||||
|
|
||||||
|
if (events.isContentNode(elem) && !buffer.focusAllowed(elem)
|
||||||
|
&& !(services.focus.getLastFocusMethod(win) & 0x7000)
|
||||||
|
&& isinstance(elem, [HTMLInputElement, HTMLSelectElement, HTMLTextAreaElement, Window])) {
|
||||||
|
if (elem.frameElement)
|
||||||
|
dactyl.focusContent(true);
|
||||||
|
else if (!(elem instanceof Window) || Editor.getEditor(elem))
|
||||||
|
dactyl.focus(window);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user