Closed GoogleCodeExporter closed 8 years ago
Fixed in revision 3b06e.
Opera is apparently the only browser that includes CR (carriage return) in a
textarea's value. The problem is that the jQuery val getter strips CR, which
then causes inconsistencies with the setSelectionRange call.
The solution is simply not to use the val function when dealing with textareas.
jQuery may have a reason to remove CR, but it's unhelpful in this case. With
just the native getters and setters, it works fine, since Opera is internally
consistent here.
Original comment by matthew....@gatech.edu
on 30 Oct 2010 at 10:48
This is now broken in IE 8, so I am reopening and renaming the bug.
Original comment by matthew....@gatech.edu
on 3 Nov 2010 at 11:31
I found Wikipedia/MediaWiki's built-in functionality for textarea manipulation
in plugins.js
(http://bits.wikimedia.org/w/extensions/UsabilityInitiative/js/plugins.combined.
js). It sets up a jQuery extension, textSelection. This seems to have the key
functionality we need, including setting the selection (setSelection),
scrolling to it (scrollToCaretPosition), and adding and highlighting new text
(encapsulateSelection).
As you can see, they've handled many of the cross-browser issues. The other
obvious advantage is that it's part of Wikipedia, so bugs should be fixed
without us having to re-deploy other code.
I think we should rely on this if possible. I'm in the process of adapting our
code.
Original comment by matthew....@gatech.edu
on 6 Nov 2010 at 6:57
[deleted comment]
This should be mostly fixed as of e7b4e. There are a couple remaining
problems. On IE 8, the caret seems to be lost when you navigate to the add
tab. Thus, you have to position it immediately before clicking the Add
Reference button.
In all browsers, the ibid text is not highlighted when inserting. This may
just require adjusting the encapsulateSelection options in
insertRefIntoMWEditBox.
Original comment by matthew....@gatech.edu
on 12 Nov 2010 at 8:06
In Chrome, selecting any reference after the first 10 or so doesn't work.
Specifically, it will highlight the text, but it won't scroll the window to the
appropriate place.
For example, in this article, you can only select references 1-11:
http://en.wikipedia.org/w/index.php?title=Star_Wars&action=edit
In this article, only references 1-17:
http://en.wikipedia.org/w/index.php?title=Georgia_Institute_of_Technology&action
=edit
Original comment by kurt.luther
on 14 Nov 2010 at 9:25
Seems to work fine in Chrome v. 7.0.517.44
Original comment by kurt.luther
on 16 Nov 2010 at 8:41
The ibid issue should be fixed in revision 37c46. This just required using
peri and replace: true. This is tested in IE 8, Safari 5.0.2, Chrome
8.0.552.23, Firefox 3.6.13pre, and Opera 10.63.
Thus, the only remaining things should be the caret on IE, and the unconfirmed
Chrome problem. I think we decided the IE caret problem wasn't a blocker (and
would be handled in docs).
Original comment by matthew....@gatech.edu
on 17 Nov 2010 at 2:40
This is confirmed in Chrome. Unfortunately it's the same version, 7.0.517.44,
though I'm running Windows 7 on this PC.
On the demo page, it produces the following JS error, and doesn't appear to
highlight any references at all:
Uncaught TypeError: Object #<an Object> has no method 'textSelection' on
ProveIt_Wikipedia.js line 132.
On Wikipedia, the same problem persists (the window won't scroll properly after
the first handful of refs). But no JS error.
Original comment by kurt.luther
on 20 Nov 2010 at 5:02
The demo problem was fixed in revision acc32. However, we confirmed during our
meeting that the incorrect scrolling applies to at least Chrome and Firefox.
Apparently, scrollToCaretPosition (from plugins.js) becomes increasingly
inaccurate for selections farther down the page.
Original comment by matthew....@gatech.edu
on 23 Nov 2010 at 10:30
The scrolling issues should be fixed in all browsers after revision 95d36 and
revision 22826. I reinserted the prior scrolling code, and removed all calls
to scrollToCaretPosition.
Original comment by matthew....@gatech.edu
on 1 Dec 2010 at 1:28
Original issue reported on code.google.com by
matthew....@gatech.edu
on 30 Oct 2010 at 12:02