Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Content is selected when dragging in Safari #997

Closed
rickycheers opened this issue Nov 18, 2016 · 14 comments
Closed

Content is selected when dragging in Safari #997

rickycheers opened this issue Nov 18, 2016 · 14 comments

Comments

@rickycheers
Copy link

Using Safari 9.1.1 in (OSX 10.11.5)

When forceFallback option is enabled, and you try to drag an element, the content is being selected.

Demo: http://jsbin.com/vebetod/edit?html,js,output

Related issue: #628 and it's fix #742

Will post a PR in a few minutes

@rafwell
Copy link

rafwell commented Jan 6, 2017

Try add this to your sortable item css:

.item{
-webkit-touch-callout: none; /* iOS Safari */
    -webkit-user-select: none; /* Chrome/Safari/Opera */
     -khtml-user-select: none; /* Konqueror */
       -moz-user-select: none; /* Firefox */
        -ms-user-select: none; /* Internet Explorer/Edge */
            user-select: none; /* Non-prefixed version, currently
                                  not supported by any browser */
}

this worked for me. ref: http://stackoverflow.com/questions/826782/how-to-disable-text-selection-highlighting-using-css

@nmcgann
Copy link

nmcgann commented Jan 19, 2017

This also fixed a firefox bug for me where I could only drag a paragraph of line-wrapped text inside a h4 with a handle class if I picked it up by the first line. On subsequent lines text was being selected instead of the paragraph moving.

This behavior wasn't present in Chrome or Edge.

@rafwell
Copy link

rafwell commented Jan 20, 2017

For me it worked in Chrome. However, I found so many other bugs that I decided to go back to Jquery Sortable. I use this directive to work with angular and is fully functional: https://github.com/angular-ui/ui-sortable

RubaXa added a commit that referenced this issue Feb 15, 2017
@RubaXa
Copy link
Collaborator

RubaXa commented Feb 15, 2017

26a7c97

@RubaXa RubaXa closed this as completed Feb 15, 2017
@itamargiv
Copy link

@RubaXa Fantastic! thank you for the fix. When is the next version release planned?

@RubaXa
Copy link
Collaborator

RubaXa commented Feb 16, 2017

February 19

@itamargiv
Copy link

itamargiv commented Feb 21, 2017

Hey @RubaXa.

It seems as though the problem still persists (at least for IE) in v1.5.0. Looks like the changes you made in the mentioned commit above were reverted by 03b49f7

@iamakulov
Copy link

I still experience this in Firefox 52 with Sortable 1.5.1.

@brice-t
Copy link

brice-t commented Apr 27, 2017

I do to in FF 53. If I put a -moz-user-select: none; rule on items or on container, the drag n' drop is buggy (mouse button needs to be released, then you can drag, and click will drop). Could not find a fix. Really annoying :(

@brice-t
Copy link

brice-t commented Apr 28, 2017

I could hack a working solution putting a -moz-user-select: none; rule on the container and using RubaXa's patch, with a condition for Firefox :
var isFirefox = typeof InstallTrigger !== 'undefined'; if ( isFirefox && options.forceFallback ) { evt.preventDefault(); }

@magnnus
Copy link

magnnus commented Jan 19, 2018

Hi, I still experience this in Safari 11.0.1 & macOS 10.13.1. But I set a css attribute to the parent element { user-select: none ; -webkit-... } , by this can fix the bug

@vegerot
Copy link

vegerot commented Feb 26, 2021

Related to #1935

I am also experiencing this

@lukasz-zaroda
Copy link

I have this issue on Chromium 127.0.6533.88 , so it seems it not only happens in Safari.

@narath
Copy link

narath commented Oct 21, 2024

I'm using FullCalendar which still requires the forceFallback option (see this issue), and so the problem of dragging causing text selection still occurs. If you are using Tailwindcss however there is an easy workaround - for the containing element (<ul> for me) just include the "select-none" element and the selection issue goes away. See this for more: https://tailwindcss.com/docs/user-select

Hope this helps. Thanks to https://github.com/alexrudall for helping me get these 2 great libraries working together.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests