Last modified: 2012-02-22 12:37:18 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T34451, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 32451 - (IE8) Click on bookmark in enhanced toolbar loses selection
(IE8) Click on bookmark in enhanced toolbar loses selection
Status: RESOLVED FIXED
Product: MediaWiki extensions
Classification: Unclassified
WikiEditor (Other open bugs)
unspecified
PC All
: Unprioritized normal (vote)
: ---
Assigned To: Nobody - You can work on this!
: javascript, patch, patch-need-review
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-11-16 23:03 UTC by Lupo
Modified: 2012-02-22 12:37 UTC (History)
3 users (show)

See Also:
Web browser: Internet Explorer
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments
Patch fixing this bug (1.11 KB, patch)
2011-11-16 23:03 UTC, Lupo
Details

Description Lupo 2011-11-16 23:03:29 UTC
Created attachment 9480 [details]
Patch fixing this bug

To reproduce:

1. Open IE8, visit some page at a WMF project (I tried it with [[commons:User:Lupo]])
2. Click "edit"
3. Place the cursor and/or select some text in the textarea. Choose a location somewhere in the middle of the text, not at the start.
4. Click on "Special characters" on the toolbar. Wait for the section to load.
5. Now change the character page: If "Latin" is displayed, click "IPA". The selection in the textarea disappears.
6. Click on any of the characters on the IPA page (without re-selecting in the textarea, obviously!)
7. The character is inserted at the very beginning of the text instead of where the cursor/selection was.

Expected behavior:
* After step 5, the selection is active in the textarea.
* In step 7, the character is inserted at the cursor position or replaces the selection.

The attached patch for jquery.wikiEditor.toolbar.js :
* solves this problem by saving the selection on mousedown and restoring at the end of the click handler of the bookmark,
* removes a stray linebreak,
* and makes sure that page tables are properly closed.
Comment 1 Lupo 2011-11-16 23:10:01 UTC
BTW, is there some reason why some click handlers in this code access the context through $( this ).data ( 'context' ) even though the context is available in the closure scope as variable "context"? The mousedown handlers generally just use the latter...
Comment 2 Lupo 2011-11-17 07:43:25 UTC
Another question: it seems anyway that the iframe stuff overrides this selection saving/restoring to not do anything, and likewise the CodeEditor. This appears to be specific to the textarea and IE. Couldn't we make the textarea itself keep track of its own selection, and get rid of these save/restore calls sprinkled throughout the code? Using IE-specific events 'beforedeactivate' (save selection) and 'activate' (restore it) on the textarea, this should be possible.
Comment 3 Roan Kattouw 2011-11-17 11:41:59 UTC
(In reply to comment #2)
> Another question: it seems anyway that the iframe stuff overrides this
> selection saving/restoring to not do anything, and likewise the CodeEditor.
> This appears to be specific to the textarea and IE. Couldn't we make the
> textarea itself keep track of its own selection, and get rid of these
> save/restore calls sprinkled throughout the code? Using IE-specific events
> 'beforedeactivate' (save selection) and 'activate' (restore it) on the
> textarea, this should be possible.
This code is mostly hacks piled on hacks, so if you have a way to make it nicer, patches are welcome :)

I'll review the patch from comment #0 later, probably over the weekend.
Comment 4 Roan Kattouw 2011-11-20 15:05:04 UTC
Patch committed in r103761.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links