Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 323988

Summary: [ipad] [Tree] Tree-item selection broken on ipad
Product: [RT] RAP Reporter: Tim Buschtoens <tbuschto>
Component: RWTAssignee: Project Inbox <rap-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: austin.riddle, jrlq, tbuschto
Version: 1.4   
Target Milestone: 1.4 M7   
Hardware: All   
OS: All   
Whiteboard:
Bug Depends on:    
Bug Blocks: 320597, 323133    
Attachments:
Description Flags
Fix for Tree TouchEvent problems none

Description Tim Buschtoens CLA 2010-08-30 11:52:21 EDT
When touching a tree-item on the label, it won't be selected. The icon or area right besides the label will work.
Comment 1 Austin Riddle CLA 2011-04-15 11:11:59 EDT
Here is what I have so far:
When the empty part of the cell is clicked, here is the sequence of events received in _filterMouseEvents in the MobileWebkitSupport 
(format is event.type [event.originalEvent]:

mouseout[TouchEvent], mouseover[TouchEvent], mousedown[TouchEvent]

When the label is clicked:

mouseout[TouchEvent], mouseover[TouchEvent],mouseover[undefined], mousemove[undefined], mousedown[undefined].

For the cases where the original event is undefined, event.preventDefault() is called.  I think this is why we don't get the touch end. Now I suppose I need to figure out what is causing these undefined originalEvents.
Comment 2 Austin Riddle CLA 2011-04-15 11:14:32 EDT
(In reply to comment #1)

This is happening on a stable "touch" using the iPad emulator. So the extra events are mysterious as well.
Comment 3 Tim Buschtoens CLA 2011-04-15 11:26:24 EDT
If the originalEvent is undefined, that usually means this mouse-event was created by the browser in an effort to emulate the mouse. These events are mostly blocked because we emulate our own events. 

So either these are rap-emulated events which for some reason dont have the original event attached, or these are the browser-emulated events and for some reason the corrosponding TouchEvents are never received/fired.
Comment 4 Austin Riddle CLA 2011-04-15 16:09:12 EDT
OK, so I figured out where the problem is coming from.  Apparently the reuse of the divs in the tree is not playing well with safari.  If I comment out element.innerHTML (TreeRow.js:347) the touch events will work. OR if I assign result.innerHTML (TreeRow.js:472) to some text or undefined, then the touch events work (although you now see things you don't want).  If I set it to null or empty (as it is already) the touch events will not work properly.
Comment 5 Austin Riddle CLA 2011-04-15 17:34:07 EDT
Created attachment 193409 [details]
Fix for Tree TouchEvent problems

Here is a fix for this bug.  There was an issue with resetting the innerHTML to "" and then right after that setting it to the column text.  I basically changed TreeRow.js to work more like TableItem.js where the properties are set outside of the call to get the cached node/div.  In the case of TreeRow I reset the innerHTML for all cases accept the label, which will set the innerHTML to the column text.
Comment 6 Tim Buschtoens CLA 2011-04-18 09:40:24 EDT
Hm. Okay, seems to work, though i dont understand what the ipads problem here is. Unless you have an even better idea, commit it.
Comment 7 Austin Riddle CLA 2011-04-18 09:51:50 EDT
Fixed in CVS HEAD.