Bug 90348

Summary: -webkit-user-select:none does not work as intended with select All( Ctrl + A)
Product: WebKit Reporter: Sanjay <sanjaylgb>
Component: CSSAssignee: Nobody <webkit-unassigned>
Status: RESOLVED DUPLICATE    
Severity: Normal CC: ap, rniwa, sanjaylgb
Priority: P3    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   

Description Sanjay 2012-07-01 07:52:55 PDT
Consider below code. The 2nd div element should not be selected, but it does get selected when i give Select All (Ctrl + A) on the browser window. 
<!DOCTYPE html>
<html>
    <head>
        <title></title>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    </head>
    <body>
        <div id="first">
            First
        </div>
        
        <div id="second"  style="-webkit-user-select:none;-moz-user-select:none">
            Second.. Cannot be selected.
        </div>
        
        <div id="third">
            Third
        </div>
    </body>
</html>

If you remove the third div element, the second one is not selected because there is no select-able element in DOM after the 2nd one which is not select-able

I tried to apply -moz-user-select to test in firefox where it works just fine.
Comment 1 Sanjay 2012-07-01 08:58:40 PDT
(In reply to comment #0)
> Consider below code. The 2nd div element should not be selected, but it does get selected when i give Select All (Ctrl + A) on the browser window. I can confirm this by giving Copy (Ctrl + c) followed by select all (Ctrl+A) and pasting the content in a text file. 
> <!DOCTYPE html>
> <html>
>     <head>
>         <title></title>
>         <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
>     </head>
>     <body>
>         <div id="first">
>             First
>         </div>
> 
>         <div id="second"  style="-webkit-user-select:none;-moz-user-select:none">
>             Second.. Cannot be selected.
>         </div>
> 
>         <div id="third">
>             Third
>         </div>
>     </body>
> </html>
> 
> If you remove the third div element, the second one is not selected because there is no select-able element in DOM after the 2nd one which is not select-able
> 
> I tried to apply -moz-user-select to test in firefox where it works just fine.
Comment 2 Sanjay 2012-07-01 09:00:10 PDT
Just to clarify.. the problem here is that the 2nd div gets copied when we select all and then copy the content to the clipboard.
Comment 3 Alexey Proskuryakov 2012-07-01 10:57:57 PDT
This is correct behavior per discussion in the original bug.

*** This bug has been marked as a duplicate of bug 80159 ***
Comment 4 Sanjay 2012-07-02 02:18:58 PDT
(In reply to comment #3)
> This is correct behavior per discussion in the original bug.
> 
> *** This bug has been marked as a duplicate of bug 80159 ***

The original bug states that Firefox works same as Safari/Chrome. But that is not true. You can test out the above code on all the three browsers. On Safari/Chrome, the non - select-able div gets copied while it does not get copied in Firefox. The behavior is clearly different.
Comment 5 Ryosuke Niwa 2012-07-02 11:28:31 PDT
(In reply to comment #4)
> (In reply to comment #3)
> > This is correct behavior per discussion in the original bug.
> > 
> > *** This bug has been marked as a duplicate of bug 80159 ***
> 
> The original bug states that Firefox works same as Safari/Chrome. But that is not true. You can test out the above code on all the three browsers. On Safari/Chrome, the non - select-able div gets copied while it does not get copied in Firefox. The behavior is clearly different.

I've re-opened the original bug so please continue the discussion there.