<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>38703</bug_id>
          
          <creation_ts>2010-05-06 16:04:18 -0700</creation_ts>
          <short_desc>user-select none should not clear selection</short_desc>
          <delta_ts>2026-08-19 09:01:51 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>HTML Editing</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>HasReduction, InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          <blocked>208677</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Erik Arvidsson">arv</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>ap</cc>
    
    <cc>arv</cc>
    
    <cc>caleb</cc>
    
    <cc>enrica</cc>
    
    <cc>franco_vieira</cc>
    
    <cc>gmak</cc>
    
    <cc>megan_gardner</cc>
    
    <cc>neil.ashford</cc>
    
    <cc>rniwa</cc>
    
    <cc>webkit-bug-importer</cc>
    
    <cc>wenson_hsieh</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>222032</commentid>
    <comment_count>0</comment_count>
      <attachid>55315</attachid>
    <who name="Erik Arvidsson">arv</who>
    <bug_when>2010-05-06 16:04:18 -0700</bug_when>
    <thetext>Created attachment 55315
Test 

If I have some selected text and then do a mousedown on an element that has user-select none the current selection should not be cleared.

The code to fix this is in Node::canStartSelection.

if (style-&gt;userDrag() == DRAG_ELEMENT &amp;&amp; style-&gt;userSelect() == SELECT_NONE)

should be changed to

if (style-&gt;userDrag() == DRAG_ELEMENT || style-&gt;userSelect() == SELECT_NONE)

The following two LayoutTests needs to be updated as well:

editing/selection/5333725.html
editing/selection/user-drag-element-and-user-select-none.html</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>269340</commentid>
    <comment_count>1</comment_count>
    <who name="">gmak</who>
    <bug_when>2010-08-25 10:48:18 -0700</bug_when>
    <thetext>Does this need #if ENABLE(DRAG_SUPPORT) flags as well? It will probably work fine without with the proposed change but all other uses of userDrag() have the define wrapped around it somewhere.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1726962</commentid>
    <comment_count>2</comment_count>
      <attachid>419682</attachid>
    <who name="Neil Ashford">neil.ashford</who>
    <bug_when>2021-02-08 23:41:15 -0800</bug_when>
    <thetext>Created attachment 419682
An extra HTML file with a similar (possibly the same) issue

The same issue, but specifically where the first selection is in a content editable element, is affecting my product. I&apos;m using Safari 14.0.2 on MacOS 11.1, so it looks like this bug (or some variant of it) is still happening.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1752272</commentid>
    <comment_count>3</comment_count>
    <who name="Caleb Hearon">caleb</who>
    <bug_when>2021-04-20 08:46:10 -0700</bug_when>
    <thetext>Based on the &quot;Test&quot; attachment, the original bug looks fixed: clicking on `-webkit-user-select: none` doesn&apos;t destroy text selection. But like Neil said, it _does_ destroy selection if the selection is in [contentEditable].

This makes it really difficult to support Safari if you have a WYSIWYG editor and have div-based controls that operate on the selection. You want the selection to stay the same while the user formats it.

Oddly the native &lt;button&gt; passes the test cases in both attachments.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2239963</commentid>
    <comment_count>4</comment_count>
    <who name="Franco Vieira de Souza">franco_vieira</who>
    <bug_when>2026-08-13 07:55:27 -0700</bug_when>
    <thetext>Currently, user-select is not implemented since we only support -webkit-user-select. This explains the undesired behavior in Neil&apos;s example.

Strictly speaking, this does not reproduce: if the pointer is held steady, clicking an element with -webkit-user-select: none does not clear selection in the given example. However, minor pointer movements while clicking do cause the selection to be cleared, which is still very bad for the WYSIWYG editor use case, and a divergence from other major browsers, so keeping this open.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2241811</commentid>
    <comment_count>5</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2026-08-19 09:01:51 -0700</bug_when>
    <thetext>&lt;rdar://problem/185324533&gt;</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>55315</attachid>
            <date>2010-05-06 16:04:18 -0700</date>
            <delta_ts>2010-05-06 16:04:18 -0700</delta_ts>
            <desc>Test </desc>
            <filename>user-select-none-should-not-clear-selection.html</filename>
            <type>text/html</type>
            <size>174</size>
            <attacher name="Erik Arvidsson">arv</attacher>
            
              <data encoding="base64">PCFET0NUWVBFIGh0bWw+Cgo8cD4xLiBTZWxlY3QgbWU8L3A+Cgo8cCBzdHlsZT0iLXdlYmtpdC11
c2VyLXNlbGVjdDogbm9uZTsgLW1vei11c2VyLXNlbGVjdDogbm9uZSI+Mi4gTW91c2UgZG93biBo
ZXJlPC9wPgoKPHA+VGhlIHNlbGVjdGlvbiBzaG91bGQgbm90IGhhdmUgYmVlbiBjbGVhcmVkLjwv
cD4K
</data>

          </attachment>
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>419682</attachid>
            <date>2021-02-08 23:41:15 -0800</date>
            <delta_ts>2021-02-08 23:41:15 -0800</delta_ts>
            <desc>An extra HTML file with a similar (possibly the same) issue</desc>
            <filename>TINY-4222.html</filename>
            <type>text/html</type>
            <size>454</size>
            <attacher name="Neil Ashford">neil.ashford</attacher>
            
              <data encoding="base64">PCFET0NUWVBFIGh0bWw+CjxodG1sIGxhbmc9ImVuIj4KPGhlYWQ+CiAgICA8bWV0YSBjaGFyc2V0
PSJVVEYtOCI+CiAgICA8dGl0bGU+U2FmYXJpIEJ1ZzwvdGl0bGU+CjwvaGVhZD4KPGJvZHk+Cjxo
MT5TYWZhcmkgYnVnPC9oMT4KPGJsb2NrcXVvdGU+QSBidWcgaW4gc2FmYXJpJ3MgPGNvZGU+dXNl
ci1zZWxlY3Q6IG5vbmU8L2NvZGU+IGhhbmRsaW5nPC9ibG9ja3F1b3RlPgo8bWFpbiBzdHlsZT0i
ZGlzcGxheTogZmxleDsgZmxleC1kaXJlY3Rpb246IGNvbHVtbjsiPgogICAgPGRpdiBjb250ZW50
ZWRpdGFibGU9InRydWUiPk1ha2UgYSBzZWxlY3Rpb24gaW5zaWRlIG9mIHRoaXMgdGV4dDwvZGl2
PgogICAgPGRpdiBzdHlsZT0iYm9yZGVyOiAycHggc29saWQgYmxhY2s7IHVzZXItc2VsZWN0OiBu
b25lOyI+QW5kIHRoZW4gY2xpY2sgaGVyZTwvZGl2Pgo8L21haW4+CjwvYm9keT4KPC9odG1sPg==
</data>

          </attachment>
      

    </bug>

</bugzilla>