Projects ⇒ Bugs ⇒ #563: textarea.focus lost on bbcode input ⇒ CPG Dragonfly™ CMS
Bug #563 textarea.focus lost on bbcode input
Project: Dragonfly 9.0.3 -> 9.3 Category: Forums
Submitted: Tuesday, June 21, 2005 (11:10:52) Modified: Monday, August 01, 2005 (12:43:53)
Status: Closed Assigned to:
PHP Version: Irrelevant HTTPD Server: Apache 1.3
Votes: 10
Vote results:
Avg. Score: 4.4 ± 0.8 Reproduced: 8 of 8 (100.0%)
Same PHP Version: 6 (75.0%) Same HTTPD Server: 4 (50.0%)

View/Vote Add Comment

by: ians
In IE but not Firefox, when using bbcode buttons like URL or IMG the input appears on the top left of the main window not in the input box.

These functions all use BBCwrite from bbcode.js, for IE the focus shifts from the textarea to the root window as you click the bbcode icon and the caret defaults to being at the origin.

The BBCwrite needs a call to "textarea.focus();" at an earlier point, for example :

function BBCwrite(form, field, start, end, force) {
var textarea = document.forms[form].elements[field];
if (textarea.caretPos) {
// Attempt to create a text range (IE).
theSelection = document.selection.createRange().text;
if (force || theSelection != '') {
document.selection.createRange().text = start + theSelection + end;
return true;

etc etc
by: DJMaze
IE version? Because we can't reproduce the bug.
by: ians
by: ians
OK, I see why you can't reproduce it, your new storeCaret maintains focus in the text area, mine did not. Yours is clearly better, but, that would make the textarea.focus calls redundant I think (the ones already there) ?
by: ians
according to this is still an issue for some users, although on apparently the same version of IE I can't replicate it either. However, the additional focus (and/or moving the call around) is essentially a no-op in most cases and, according to user reports, does address their issue so it should be there.
by: Kuragari
I've reproduced this with IE 6.0.2800.1106.xpsp2.030422-1633 on this site.
by: alva
It makes a difference wether youre starting off with code or text.
To reproduce on this site: type some text then select codebutton or emoticon.
by: alva
Note: bug doesn't exist in in
by: insaner
I am also seeing this, on multiple machines. I use IE and SP2. Any bbcode will go to the top left corner of the screen.
by: ians has a fixed version of bbcode. just the one line change for focus.
by: alva
Interesting views from darkgrue and ians in another topicthread (started by Jagarm) here:
by: Phoenix
This bug has been fixed in the CVS.

Snapshots of the sources are packaged every 6 hours; this change
will be in the next snapshot. You can grab the snapshot at the
Downloads section.

Thank you for the report, and for helping us to make CPG-Nuke 9.0.3 -> 9.1 better.

Your fix adopted - thanks Ians
User Info

Welcome Anonymous


Support for DragonflyCMS in a other languages: