Make WordPress Core

Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#19528 closed defect (bug) (fixed)

HTML editor link quicktag not working in IE9

Reported by: johnp's profile JohnP Owned by: azaozz's profile 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)

19528.diff (1.2 KB) - added by solarissmoke 12 years ago.
Store selection information before textarea loses focus

Download all attachments as: .zip

Change History (7)

#1 @linuxologos
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

Introduced in WP 3.2.

@solarissmoke
12 years ago

Store selection information before textarea loses focus

#2 @solarissmoke
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.

#3 @cgrymala
12 years ago

  • Cc curtiss@… added

#4 @nacin
12 years ago

  • Milestone changed from Awaiting Review to 3.4
  • Priority changed from normal to high

#5 @azaozz
12 years ago

  • Owner set to azaozz
  • Resolution set to fixed
  • Status changed from new to closed

In [20428]:

Fix inserting links in the HTML editor in IE9, fixes #19528

#6 @azaozz
12 years ago

19528.diff would work too but better to use the native IE range object when in IE.

Note: See TracTickets for help on using tickets.