Closed Bug 854072 Opened 11 years ago Closed 7 years ago

Press and hold on empty space brings up nonsensical selection

Categories

(Firefox for Metro Graveyard :: Input, defect, P2)

x86_64
Windows 8.1
defect

Tracking

(Not tracked)

RESOLVED INCOMPLETE

People

(Reporter: jimm, Unassigned)

References

Details

(Whiteboard: [selection] p=8)

Attachments

(3 files, 1 obsolete file)

str:

- press hold on background content 

result: 
- selection monocles are displayed bordering nonsensical content
- context menu is displayed with 'copy' and pointless 'search bing for ""' options

expected:
- nothing should happen
Defect for it5?
Blocks: 831952
No longer blocks: metrov1triage
Flags: needinfo?(asa)
Moving to iteration #5 for consideration as a defect.
Blocks: metrov1it5
Flags: needinfo?(asa)
Priority: -- → P1
QA Contact: jbecerra
Summary: Press and hold on empty space brings up nonsensical context menu options → Defect - Press and hold on empty space brings up nonsensical context menu options
Whiteboard: feature=defect c=Context_menus u=metro_firefox_user p=tbd
Assignee: nobody → jmathies
Attached image example regions
I'm not sure how to solve this. What we want to be able to do in ContextMenuHandler is make a smart choice about whether or not the user intended to invoke selection on underlying text content.

http://mxr.mozilla.org/mozilla-central/source/browser/metro/base/content/contenthandlers/ContextMenuHandler.js#220

The popup dom node is commonly an element type. If we instance of test it it can be anything depending on the underlying content. I have a test case where I have form inputs that run down the left side of a page an if I press-hold in the empty content to the right, I get a form element. In the test case pictured here I get a div. So I don't think the element type is of much help.

What I need to be able to do is ask the dom "hey, is there selectable content near this point?" but afaik we don't have anything like that available.

cc'ing a few folks who might have some ideas.
My plan for Fennec was to do something like:

if (DOMWindowUtils.selectAtPoint()) {
  var rects = getSelection().getRangeAt(0).getBoundingClientRect(); // I hope this is a 0x0 rect at some point?
  // if point is near rects, continue selection, otherwise cancel it
}
(In reply to Wesley Johnston (:wesj) from comment #4)
> My plan for Fennec was to do something like:
> 
> if (DOMWindowUtils.selectAtPoint()) {
>   var rects = getSelection().getRangeAt(0).getBoundingClientRect(); // I
> hope this is a 0x0 rect at some point?
>   // if point is near rects, continue selection, otherwise cancel it
> }

That would work in the test case I have, although I think you might see a brief flash of selection rendered after calling selectAtPoint. In the screenshot I posted, the selection would be some random chunk of the text to the left of where you placed your finger.
Maybe selectAtPoint can be trained to be more 'selective' than this. Although I'd prefer to find a solution that doesn't involve mucking with c++ selection code. :)
Attachment #730814 - Attachment is patch: false
Attachment #730814 - Attachment mime type: text/plain → image/png
True. In fennec, our selection starts by positioning the cursor with a mouse click, which is horrible, but also invisible (and hopefully all those hacks are going away). I assumed nothing would show.
Whiteboard: feature=defect c=Context_menus u=metro_firefox_user p=tbd → feature=defect c=Context_menus u=metro_firefox_user p=8
Status: NEW → ASSIGNED
Summary: Defect - Press and hold on empty space brings up nonsensical context menu options → Defect - Press and hold on empty space brings up nonsensical selection
Attached patch forms fix (obsolete) — Splinter Review
We can avoid this in certain cases (like my test case) by being more careful about when we call selectAtPoint.
Attached patch forms fixSplinter Review
Attachment #735215 - Attachment is obsolete: true
Blocks: metrov1it6
No longer blocks: metrov1it5
Point Estimate = 8.
Blocks: metrov1defect&change
No longer blocks: metrov1it6
Whiteboard: feature=defect c=Context_menus u=metro_firefox_user p=8 → feature=defect c=Context_menus u=metro_firefox_user p=0
Assignee: jmathies → nobody
Priority: P1 → --
Priority: -- → P4
Priority: P4 → --
Whiteboard: feature=defect c=Context_menus u=metro_firefox_user p=0 → [selection] feature=defect c=Context_menus u=metro_firefox_user p=0
No longer blocks: metrov2defect&change
Summary: Defect - Press and hold on empty space brings up nonsensical selection → Press and hold on empty space brings up nonsensical selection
Whiteboard: [selection] feature=defect c=Context_menus u=metro_firefox_user p=0 → [selection] [defect] p=0
Blocks: 957244
No longer blocks: 831952
Status: ASSIGNED → NEW
Whiteboard: [selection] [defect] p=0 → [selection] [defect] p=8
Priority: -- → P2
Whiteboard: [selection] [defect] p=8 → [selection] p=8
Blocks: 956697
QA Contact: jbecerra
OS: Windows 8 Metro → Windows 8.1
Mass close of bugs in obsolete product https://bugzilla.mozilla.org/show_bug.cgi?id=1350354
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: