Security News
Cloudflare Adds Security.txt Setup Wizard
Cloudflare has launched a setup wizard allowing users to easily create and manage a security.txt file for vulnerability disclosure on their websites.
@telerik/kendo-draggable
Advanced tools
A cross-browser/event abstraction that handles mouse and touch drag sequences
A cross-platform abstraction for drag sequences. Handles mouse drags and touch sequences on mobile devices.
Drag sequence means:
The library is published as scoped NPM package in the NPMJS Telerik account.
npm install --save '@telerik/kendo-draggable';
The draggable class constructor accepts an object with three optional event handler callbacks - press
, drag
, and release
.
import Draggable from '@telerik/kendo-draggable';
const draggable = new Draggable({
press: function(e) {
console.log("pressed", e.pageX, e.pageY);
},
drag: function(e) {
console.log("drag", e.pageX, e.pageY);
},
release: function(e) {
console.log("release", e.pageX, e.pageY);
}
});
draggable.bindTo(document.getElementById("my-element"));
The draggable may be re-bound to another element - the event handlers will be automatically unbound from the previous one.
draggable.bindTo(document.getElementById("another-element"));
Since the draggable object persists a reference to the currently bound element, it should be destroyed when/if the corresponding element is removed from the document.
draggable.destroy();
Handling the drag sequence on mobile devices may require disabling of the touch based scrolling.
The draggable will not do that out of the box. The recommended way to handle this is by setting a touch-action
CSS property.
Depending on the type of drags handled, you may need touch-action: none
, touch-action: pan-y
or touch-action: pan-x
.
Notice: touch-action
does not work for iOS (yet). Limited support should be available in iOS 9.3, which just got released. However, pan-x
and pan-y
don't work.
The simplest means to disable the scrolling in iOS is by preventing the touchstart
event:
<div ontouchstart="return false">
<div id="my-draggable-element"></div>
</div>
Dragging elements with text in them will activate the browser text selection, which, in most cases, is not desirable.
To avoid this, use user-select: none
CSS property with its respective browser prefixes.
FAQs
A cross-browser/event abstraction that handles mouse and touch drag sequences
The npm package @telerik/kendo-draggable receives a total of 55,766 weekly downloads. As such, @telerik/kendo-draggable popularity was classified as popular.
We found that @telerik/kendo-draggable 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
Cloudflare has launched a setup wizard allowing users to easily create and manage a security.txt file for vulnerability disclosure on their websites.
Security News
The Socket Research team breaks down a malicious npm package targeting the legitimate DOMPurify library. It uses obfuscated code to hide that it is exfiltrating browser and crypto wallet data.
Security News
ENISA’s 2024 report highlights the EU’s top cybersecurity threats, including rising DDoS attacks, ransomware, supply chain vulnerabilities, and weaponized AI.