Find does find text in -moz-user-select: none nodes, but doesn't highlight them

RESOLVED FIXED in mozilla12

Status

()

Core
Selection
RESOLVED FIXED
9 years ago
2 years ago

People

(Reporter: Martijn Wargers (dead), Assigned: jdm)

Tracking

({testcase})

unspecified
mozilla12
x86
Windows XP
testcase
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(URL)

Attachments

(1 attachment)

(Reporter)

Description

9 years ago
The testcase is from bug 451252, when searching for the word 'mozilla', you'll notice that the first occurrence of that word in the page gets highlighted, but the second and third not, even though they are being found.
It seems to me the second and third occurrence should also get highlighted.
(Reporter)

Comment 1

9 years ago
This probably more belongs in Core->Selection.

For me -moz-user-select: none; means, the text can't be selected by the user in any way (by mouse or by keyboard), but the text should still be selectable by dom methods or the find code.
Component: Find Backend → Selection
QA Contact: find-backend → selection
>For me -moz-user-select: none; means, the text can't be selected by the user in
>any way (by mouse or by keyboard), but the text should still be selectable by
>dom methods or the find code.

Well nsFrame::Handle{Press|Click|Drag} etc already have a IsSelectable check to disallow the user's selection there and then, so most of the time I think we're already only reaching nsFrame::SetSelected either when we are a user 
selection and the frame is selectable or when we are a programmatic selection.

The problem would be "Select All" - "cmd_selectAll" is used by the keypress handlers etc for commands coming from the UI, but equally it is also used for the same effect in other areas of the code too. Clearly we still need the IsSelectable check within SetSelected - it allows "Select All" logic to simply add a single range running from the document start to end, and let the painting logic worry about where the selection is painted - but for the above definition of what -user-select-none to work we would then need to execute the check conditionally on a UI select-all.

That in turn would mean SetSelected would need to be passed a parameter detailing whether the call was a result of a select all command that came from the UI, which I don't imagine is desirable.

roc, any thoughts?
Let's look at this another way: what is the best user experience when the user searches for text and there's a match in -moz-user-select:none?
1) Refusing to find the match will surprise the user. Bad.
2) Showing the text as a normal selection when the text cannot be selected manually is also surprising. Bad.
3) Showing the text with a different selection style may also be confusing. Bad.

Hmm. Actually I think the real usability problem here is -moz-user-select:none. Having special text that the user can't select in a document where all other text can be selected seems like it's just going to confuse people. Why do we need it?
(Reporter)

Comment 4

8 years ago
I guess it's needed for xul documents, because it's used there to make text unselectable. Perhaps it is possible to make the css property only applicable to xul elements or for xul documents or for both?
Maybe we should just skip matches that are in, or partially in, -moz-user-select:none?
Not a great solution but not worse than all the others.
Perhaps mconnor could weigh in on the UX side of this problem. Mike, see comment #3.
(Reporter)

Comment 8

8 years ago
(In reply to comment #5)
> Maybe we should just skip matches that are in, or partially in,
> -moz-user-select:none?

I don't agree with this. I (and I think every normal user) would feel cheated when you're searching for a word, which is in the document, but isn't highlighted just because it has -moz-user-select:none.
OK, suppose we go back to the idea that -moz-user-select:none only disables selection UI but content can be programmatically selected (my option 2 in comment #3). Suppose we have a -moz-user-select:none element in a document and the user starts a selection before the element and drags the end of the selection after the element. Should the element look selected or not?

I'm inclined to say it should, and select-all should select it too.
(Reporter)

Comment 10

8 years ago
(In reply to comment #9)
> I'm inclined to say it should, and select-all should select it too.

I'm not sure I agree with you, but I don't think I care about it much either. It seems to me the whole -moz-user-select concept is kind of broken anyway.

Yeah, I think that content should be able to be programmatically selected, imho.
So, it seems there's a not-dissimilar discussion taking place in m.d.platform

http://groups.google.com/group/mozilla.dev.platform/browse_thread/thread/c018736feaf7c65f

Updated

7 years ago
Duplicate of this bug: 570713

Updated

6 years ago
Duplicate of this bug: 693235

Comment 14

6 years ago
Try run for 990f0f3158dc is complete.
Detailed breakdown of the results available here:
    https://tbpl.mozilla.org/?tree=Try&rev=990f0f3158dc
Results (out of 55 total builds):
    success: 48
    warnings: 7
Builds (or logs if builds failed) available at:
http://ftp.mozilla.org/pub/mozilla.org/firefox/try-builds/josh@joshmatthews.net-990f0f3158dc
(Reporter)

Comment 15

6 years ago
Mozilla RelEng Bot, what do you mean?
(Assignee)

Comment 16

6 years ago
Created attachment 588039 [details] [diff] [review]
Allow programmatic selection of -moz-user-select: none frames.

I wrote a patch, but decided to see what tryserver thought of it before showing anybody else. Robert, I don't really understand all the complexities at play here, but this patch makes all nsTextFrames selectable if the caller is able to call SetSelectedRange. That means that mouse selection remains disallowed, because the input handling in nsFrame checks IsSelectable first.
(Assignee)

Comment 17

6 years ago
Comment on attachment 588039 [details] [diff] [review]
Allow programmatic selection of -moz-user-select: none frames.

See previous comment.
Attachment #588039 - Flags: feedback?(roc)
Attachment #588039 - Flags: feedback?(roc) → review+
(Assignee)

Comment 18

6 years ago
http://hg.mozilla.org/integration/mozilla-inbound/rev/efdfbd08a433
Assignee: nobody → josh
https://hg.mozilla.org/mozilla-central/rev/efdfbd08a433
Status: NEW → RESOLVED
Last Resolved: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla12

Updated

2 years ago
Duplicate of this bug: 708047
You need to log in before you can comment on or make changes to this bug.