1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-01-06 22:14:12 +01:00

Take focus from elements when they collapse. Small naming fix for Doug's sake. Closes issue #36.

--HG--
extra : rebase_source : aa0f776bafdeddc8a8b45ca3430de18ab535babc
This commit is contained in:
Kris Maglione
2010-10-03 10:24:01 -04:00
parent c85b53232f
commit 69ed86178d
3 changed files with 26 additions and 8 deletions

View File

@@ -693,6 +693,21 @@ const Events = Module("events", {
}
},
/**
* Ensures that the currently focused element is visible and blurs
* it if it's not.
*/
checkFocus: function () {
if (dactyl.focus) {
let rect = dactyl.focus.getBoundingClientRect();
if (!rect.width || !rect.height) {
dactyl.focus.blur();
// onFocusChange needs to die.
this.onFocusChange();
}
}
},
// TODO: Merge with onFocusChange
onFocus: function (event) {
let elem = event.originalTarget;
@@ -1157,6 +1172,11 @@ const Events = Module("events", {
},
{ arg: true, count: true });
},
options: function () {
options.add(["strictfocus", "sf"],
"Prevent scripts from focusing input elements without user intervention",
"boolean", true);
},
sanitizer: function () {
sanitizer.addItem("macros", {
description: "Saved macros",