Coder Social home page Coder Social logo

Comments (2)

paulgibbs avatar paulgibbs commented on July 17, 2024

I had a similar-but-different problem with contentEditable elements inside a div. The div also contained a <button> which was the div's drag handle for this plugin. The items.attr('draggable', 'true') line (items === the wrapper for the div(s)) was breaking the contentEditable elements on iOS 7 (and in the iOS Simulator) -- but it was working fine in desktop Chrome.

I've made a local mod and set the draggable property in mouseup/down handlers, which works to fix the problem for me, though obviously isn't good enough to submit back to the plugin:

diff --git a/sortable.js b/sortable.js
index 77ed290..4944218 100755
--- a/sortable.js
+++ b/sortable.js
@@ -52,9 +52,11 @@

       items.find(options.handle).mousedown(function () {
         isHandle = true;
+        items.attr('draggable', 'true');
       }).mouseup(function () {
-          isHandle = false;
-        });
+        isHandle = false;
+        items.attr('draggable', 'false');
+      });
       $(this).data('items', options.items);
       placeholders = placeholders.add(placeholder);
       if (options.connectWith) {
@@ -64,7 +66,7 @@
       items.attr('role', 'option');
       items.attr('aria-grabbed', 'false');

-      items.attr('draggable', 'true').on('dragstart.h5s',function (e) {
+      items.on('dragstart.h5s',function (e) {
         e.stopImmediatePropagation();
         if (options.handle && !isHandle) {
           return false;

from html5sortable.

lukasoppermann avatar lukasoppermann commented on July 17, 2024

Closing this for now, however if anyone would like to send a PR I would appreciate it.

from html5sortable.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.