A personal wiki living in a self-modifying XHTML file
You are not logged in.
Abstract: While trying to add hotkeys to woas (F2 is edit or save, F4 is search, shift+F2 is create page in current namespace, etc) I encountered a bug that is hard to track down.
To visualize it, put this on a page:
<div id="whohasit"></div>
<script>
var curElement = document.activeElement;
$("whohasit").innerHTML = curElement + " " + curElement.id;
setTimeout( '$("whohasit").innerHTML = document.activeElement +" " + document.activeElement.id;', 4000);
</script>Reload woas, it will say:
[object HTMLBodyElement] body
but after editing using F2 and F2 again to save, it says:
[object HTMLTextAreaElement] wiki_editor
If you do a
$("wiki_editor").blur();
$("wiki_text").focus();
setTimeout('$("wiki_text").blur();',1);
it returns that the focus has been set back... but caret mode is activated (you get a silly cursor in your page which you can move with your cursor keys, remove it using F7).
to be continued....
Offline
Well... so I was cycling back from work (I live a 1/2 hour from work, and here in the Netherlands its custom to use the bike) and I thought: Well, if the editor goes invisible, then the cursor has no other way to go but to go to the main window... and once I went home I did:
$("wiki_editor").blur();
save();
And it worked! So there is the bug in Firefox 3.5: if you hide a text area while having a cursor capture, the cursor stays "on".
I'm going to cleanup and commit now...
part 3: You would think that taking the first line "$("wiki_editor").blur();" and putting it in the save() function as the FIRST command, that it would not matter.... wrong.... woas reverts to the bug... hmm...
Last edited by FBnil (05-02-2010 21:35:20)
Offline
You really did not notice this in stickwiki.js?
function ff_fix_focus() {
//runtime fix for Firefox bug 374786
if (firefox)
$("wiki_text").blur();
}http://bugzilla.mozilla.org/show_bug.cgi?id=374786
I wish you had seen it before! Perhaps you would have saved some time... ![]()
I also spent a lot of time to find it when developing WoaS
Offline