#19528 closed defect (bug) (fixed)
HTML editor link quicktag not working in IE9
Reported by: | JohnP | Owned by: | azaozz |
---|---|---|---|
Milestone: | 3.4 | Priority: | high |
Severity: | major | Version: | 3.2 |
Component: | Editor | Keywords: | has-patch dev-feedback |
Focuses: | Cc: |
Description
Using IE9, type some text in the HTML editor, select a couple of words at the end and click "link" quicktag.
The Insert/edit link box pops up normally, enter URL, click "Add Link".
When you return to the editor, ALL the text is selected, and the link is placed at the beginning.
Can be fixed by setting browser to "compatibility view"
Not fixed by 3.3 upgrade.
Attachments (1)
Change History (7)
#1
@
12 years ago
- Keywords needs-patch added
- Summary changed from HTML editor link quiktag not working in IE9 to HTML editor link quicktag not working in IE9
- Version changed from 3.3 to 3.2
#2
@
12 years ago
- Keywords has-patch dev-feedback added; needs-patch removed
Tracked this down to the following code in wplink.dev.js
:
if ( typeof textarea.selectionStart !== 'undefined' ) { start = textarea.selectionStart; end = textarea.selectionEnd; selection = textarea.value.substring( start, end );
This was originally designed to bypass IE which didn't support selectionStart
/selectionEnd
. However IE9 does. Problem is it sets both attributes to 0 when the textarea loses focus, which is what causes the behaviour described above.
Attached a patch that fixes this by storing the selection information before the textarea loses focus. This seems to me a better approach generally, as from what I can see the HTML5 spec doesn't explicitly say what should happen to selection data when focus is lost, so IE9 is not necessarily wrong in how it handles it.
#4
@
12 years ago
- Milestone changed from Awaiting Review to 3.4
- Priority changed from normal to high
Introduced in WP 3.2.