[Webkit-unassigned] [Bug 66948] New: Preventing user selection using "selectstart" not working

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Aug 25 09:13:39 PDT 2011


https://bugs.webkit.org/show_bug.cgi?id=66948

           Summary: Preventing user selection using "selectstart" not
                    working
           Product: WebKit
           Version: 528+ (Nightly build)
          Platform: Unspecified
               URL: http://code.google.com/p/chromium/issues/detail?id=937
                    71
        OS/Version: Unspecified
            Status: UNCONFIRMED
          Severity: Normal
          Priority: P2
         Component: Event Handling
        AssignedTo: webkit-unassigned at lists.webkit.org
        ReportedBy: johnjbarton at johnjbarton.com


Chrome Version       : 13.0.782.112 m and 15.0.859.0 canary 

This problem only happens on Chrome
This problem is affecting the editor in Orion Project 
URLs (if applicable) : http://eclipse.org/orion/


What steps will reproduce the problem?
1. Use the following HTML
<!DOCTYPE html>
<html>
<head>
<title>test</title>
<script>

function myOnLoad() {
    var el = document.getElementById("myDiv");
    el.addEventListener("selectstart", function(e) {
        e.preventDefault()
    });
    var range = document.createRange();
    range.setStart(el.firstChild, 0);
    range.setEnd(el.firstChild, 0);
    var sel = window.getSelection();
    sel.addRange(range);
}

</script>
<style>
.myClass {
 width:100px;
 height:100px;
 background:yellow;
 position: absolute;
 top: 200px;
 left: 200px;    
// user-select:none;            // NO OP
// -webkit-user-select:none;    //WORKS BUT window.getSelection().addRange() also stops working
}
</style>
</head>
<body onload="myOnLoad()">
<div id="myDiv" contentEditable="true" class="myClass" >
sample text that should not get selected
</div>

</body>
</html>


2. Click and hold in the text content in the div.
3. Move the mouse (still holding the mouse button down) inside the bounds of the div, selection does not happen (correct)
4. Move the mouse outside the bounds of the div, text selection starts (wrong)
5. Move back inside the bounds of div and keep moving the mouse, text selection happens (wrong)

What is the expected result?
text selection should never happen.

What happens instead?
text selection start to happen.

Please provide any additional information:
This used to work, I suspect that this was working as recent as chrome 12.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list