html5sortable icon indicating copy to clipboard operation
html5sortable copied to clipboard

addEventListener is not working correctly if the root of a nested list has only one list-element

Open tuberlinapp opened this issue 7 years ago • 1 comments
trafficstars

I'm opening this issue because:

addEventListener is not working correctly if the root of a nested list has only one list-element

supporting information:

  • I use sortable version: 0.9.4
  • I tested in the following browser (incl. versions): Firefox Dev 63.0b11 AND Firefox Standard 62.0.3
  • Windows, OS X/macOS, or Linux?: Windows 10 AND Debian 9

How can the issue be reproduce the problem?

Please add a complete description of how to reproduce the problem.

  • Load the file
  • If you drag "Item 444" above "Item 333" event is not called.
  • If you drag "Item 444" above "Rootpage" event is called.
<!doctype html>

<head>
<meta charset="utf-8">
<title>HTML5 Sortable library</title>
<link rel="stylesheet" href="basscss.css">
  <script src="html5sortable.js"></script>
</head>
<body>
<h2>Drag working, but no event listening on ul-element</h2>
<ul>
  <li>
    Rootpage
    <ul>
      <li>Item 1</li>
      <li>Item 2</li>
      <li>Item 333</li>
      <li>
        Checker
        <ul>
          <li>Item 4</li>
          <li>Item 4</li>
          <li>Item 444</li>
        </ul>
      </li>
      <li>Item 4</li>
      <li>Item 5</li>
      <li>Item 6</li>
      <li>Item 7</li>
    </ul>
  </li>
</ul>
<script>
    sortable('ul', {
        acceptFrom: '*',
        forcePlaceholderSize: true,
        placeholderClass: 'border'
    });
document.querySelector('ul').addEventListener('sortupdate', function(e){
    console.log(e);
});
    </script>
</body>

Thank you for contributing!

  • Please make sure your contribution is in line with the contribution guidelines: https://github.com/lukasoppermann/html5sortable/blob/master/CONTRIBUTING.md

  • Participation in this open source project is subject to the Code of Conduct: https://github.com/lukasoppermann/html5sortable/blob/master/CODE_OF_CONDUCT.md

Before creating a feature requests, please review the existing feature requests and make sure there isn't one that already describes the feature you are missing: https://github.com/lukasoppermann/html5sortable/issues?q=is%3Aopen+is%3Aissue+label%3Afeature

What's the feature?

What problem is the feature intended to solve?

Is this feature similar to an existing feature in another project?

tuberlinapp avatar Oct 05 '18 11:10 tuberlinapp

Hey @tuberlinapp,

thanks for filing the issue. Do you have any idea on how to solve this by any chance?

lukasoppermann avatar Oct 11 '18 09:10 lukasoppermann