Open Bug 319666 Opened 19 years ago Updated 3 years ago

ondblclick event should be able to cancel word selection (e.g. using preventDefault)

Categories

(Core :: DOM: Selection, defect, P5)

1.8 Branch
defect

Tracking

()

People

(Reporter: erickt, Unassigned)

Details

(Keywords: testcase)

Attachments

(2 files)

User-Agent:       Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/416.12 (KHTML, like Gecko) Safari/416.13
Build Identifier: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.8) Gecko/20051111 Firefox/1.5

I'm trying to make a very simple page where you click on a <td> in order to change the color. However, I find that if I handle the "ondblclick", the space I have in the <td> gets automatically selected. Since I've specified the ondblclick event handler, I'd assume that this would overload the "double click selects a word" in the <td>.



Reproducible: Always

Steps to Reproduce:
I'll attach a html file demonstrating this problem. To reproduce, simply double click on the table element.
Actual Results:  
the space in the <td> gets selected along with the <td> changing color.

Expected Results:  
the <td> should just change color.
Assignee: nobody → selection
Component: General → Selection
Product: Firefox → Core
QA Contact: general
Version: unspecified → 1.0 Branch
Version: 1.0 Branch → 1.8 Branch
I see the same thing you see.  I'm using Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a1) Gecko/20051209 Firefox/1.6a1.  I also see the same behavior using IE7.

Setting up an event listener never automatically cancels the default action, as far as I know.  Returning false or calling event.preventDefault() from the event listener, however, usually does cancel the default action.  I think it's a bug that returning false doesn't prevent the default action (word selection) for double clicking.  Even calling event.stopPropagation() from a capturing dblclick handler doesn't prevent word selection.

As a workaround, you can make your table cell be truly empty, and make the cell appear by putting style="empty-cells:show;" on the table.  That doesn't seem to work in IE7, though.
Status: UNCONFIRMED → NEW
Ever confirmed: true
OS: MacOS X → All
Hardware: Macintosh → All
Summary: using "ondblclick" event on a <td> in a table shouldn't cause text selection → ondblclick event should be able to cancel word selection (e.g. using preventDefault)
Keywords: testcase
Note that you'll only see the undesired behavior in IE if your cursor is over the &nbsp; when you double-click.
Assignee: selection → nobody
QA Contact: selection

Bulk-downgrade of unassigned, >=3 years untouched DOM/Storage bug's priority.

If you have reason to believe this is wrong, please write a comment and ni :jstutte.

Severity: normal → S4
Priority: -- → P5
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: