Skip to main content

Search and Top Navigation

#4773 closed bug (fixed)

Opened August 12, 2009 08:32AM UTC

Closed December 29, 2009 01:33AM UTC

Last modified January 17, 2010 06:00AM UTC

Enable text selection in Internet Explorer

Reported by: stakach Owned by:
Priority: major Milestone: 1.8
Component: ui.core Version: 1.7.2
Keywords: Internet Explorer IE Text Selection Draggable Cc:
Blocked by: Blocking:

Currently (Unlike all other browsers) there is no way to select text in draggable objects in internet explorer even if a handle is provided.

This is caused by two pieces of code.

Firstly: (This code should be removed)

in $.ui.mouse -> mouseInit
// Prevent text selection in IE
if ($.browser.msie) {
	this._mouseUnselectable = this.element.attr('unselectable');
	this.element.attr('unselectable', 'on');

Secondly: (These functions require the last line of code to be added)

in $.fn.extend

enableSelection: function() {
	return this
		.attr('unselectable', 'off')	//Not sure if needed now
		.css('MozUserSelect', '')
		.unbind('selectstart.disableTextSelect');	//ie select enable

disableSelection: function() {
	return this
		.attr('unselectable', 'on')	//Not sure if needed now
		.css('MozUserSelect', 'none')
		.bind('selectstart.ui', function() { return false; })
		.bind('selectstart.disableTextSelect', function() { return false; }); //ie select disable

What do people think?

Works for me.

Attachments (1)
  • ie select fix.patch (1.3 KB) - added by stakach August 13, 2009 02:10AM UTC.

    IE selection patch

Change History (6)

Changed August 12, 2009 09:06AM UTC by stakach comment:1

Tested in Firefox 3.5, IE 6-7-8, Chrome, Safari 4 for windows with no issues

Changed November 16, 2009 11:17AM UTC by jzaefferer comment:2

milestone: TBD1.8
priority: minormajor

Looks good.

Changed November 26, 2009 04:23AM UTC by stakach comment:3

Thanks. I'm using this patch with a web application for sydney university and everything is working perfectly.

Also there are no syntax errors in the patch unlike my description. :)

Changed December 13, 2009 11:30AM UTC by jzaefferer comment:4

I don't see why you bind the selectstart event twice. Though removing the $.browser.msie check from mouseInit definitely makes a difference. I have no idea why that is there anyway.

Changed December 17, 2009 12:18AM UTC by stakach comment:5

Yeah - I'm using selectables, resizables and draggables without problems.

Second bind is not needed.

This is my first jQuery project, been using, and wasn't sure about event namespaces.

Changed December 29, 2009 01:33AM UTC by scottgonzalez comment:6

resolution: → fixed
status: newclosed

Fixed in r3546. Thanks stakach.