textarea focua (push quicktag button = cursor jumps to top)

rkn - February 28, 2007 - 14:32
Project:quicktags
Version:HEAD
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:closed
Description

Someone posted this on the homepage for this great module a while back:

whenever you use any of the included markup buttons, the textarea focus returns to the top of the document. For editing anything longer than a paragraph or two, this is really hard for users, as they immediately loose their place in the document.

That was over a year ago and it doesnt seem to have been brought up here. I also find this annoying. Anyone have ideas for a fix?

#1

tcblack - November 12, 2007 - 20:34

I cannot replicate this on my system using either firefox 2.0.0.9 or IE 7.x
since this has been open for so long with no other feedback, I vote to close this issue.

#2

peterpoe - January 11, 2008 - 17:28

I had this issue in Firefox 3b2. I added two lines to the javascript and it's now gone.
At the beginning of edInsertTag function:
prevTop = myField.scrollTop;
at the end of the function:
myField.scrollTop = prevTop;

The same could be probably added to edInsertContent too.

#3

tcblack - January 11, 2008 - 18:57
Status:active» active (needs more info)

Could you provide a patch for this?

#4

tcblack - February 25, 2008 - 21:29
Version:5.x-1.x-dev» HEAD
Status:active (needs more info)» patch (code needs review)

I finally had a chance to add these lines to the JS at both edInsertTag and edInsertContent and create a patch (attached).
Let's get some testing and feedback on this.

Reassigning to HEAD since that's where modifications should go.

+1 on works for me.

AttachmentSize
quicktags.js_.textarea-focus.patch874 bytes

#5

jan krummrey - February 26, 2008 - 13:25

I've applied the patch.

Works better in Firefox now. Doesn't jump back to the top of the text.

Jan

#6

johnbeamer - February 27, 2008 - 04:23
Status:patch (code needs review)» patch (reviewed & tested by the community)

I've tested this extensively at a couple of sites and it fixes the issue. It should definitely be part of the next release.

#7

tcblack - February 27, 2008 - 14:57
Status:patch (reviewed & tested by the community)» fixed

Since this effectively repairs a bug I've committed it to CVS Head.
I'm hoping to get some of the more ready patches committed before branching off for Drupal 6.x (No I don't have a specific time for a branch).

#8

Anonymous (not verified) - March 12, 2008 - 15:02
Status:fixed» closed

Automatically closed -- issue fixed for two weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.