Security News
The Risks of Misguided Research in Supply Chain Security
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.
drag-drop-touch
Advanced tools
Polyfill that enables HTML5 drag drop support on mobile (touch) devices
Polyfill that enables HTML5 drag and drop support on mobile (touch) devices.
The HTML5 specification includes support for drag and drop operations. Unfortunately, most mobile browsers do not implement it, so applications that rely on HTML5 drag and drop have reduced functionality when running on mobile devices.
The DragDropTouch class is a polyfill that translates touch events into standard HTML5 drag drop events. If you add the polyfill to your pages, drag and drop operations should work on mobile devices just like they do on the desktop.
The demo should work on desktop as well as on mobile devices, including iPads and Android tablets.
The top section of the demo is based on a well-known HTML5 drag and drop sample from html5rocks.
The following sections demonstrate how the polyfill works with standards-based components that use HTML5 drag and drop. You can use touch to resize and reorder grid columns, data groups, and pivot fields.
You can install this polyfill via NPM using the following command:
npm i --save drag-drop-touch
Alternatively, download DragDropTouch.js
and add it to your HTML:
<script src="DragDropTouch.js"></script>
The DragDropTouch polyfill attaches listeners to the document's touch events:
To avoid interfering with the automatic browser translation of some touch events into mouse events, the polyfill performs a few additional tasks:
Thanks to Bernardo Castilho, who pretty much wrote this entire polyfill apart from a couple of tweaks: DragDropTouch.
Thanks to Eric Bidelman for the great tutorial on HTML5 drag and drop: Native HTML5 Drag and Drop.
Thanks also to Chris Wilson and Paul Kinlan for their article on mouse and touch events: Touch And Mouse.
Finally, thanks to Tim Ruffles for his iOS shim code which was inspiring: iOS DragDrop Shim.
FAQs
Polyfill that enables HTML5 drag drop support on mobile (touch) devices
The npm package drag-drop-touch receives a total of 6,099 weekly downloads. As such, drag-drop-touch popularity was classified as popular.
We found that drag-drop-touch demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.
Research
Security News
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.