sitepoint-editors / accessible-drag-and-drop Goto Github PK
View Code? Open in Web Editor NEWExtend the capabilities of HTML5 drag and drop — so it can handle multiple elements, and support keyboard interaction
Extend the capabilities of HTML5 drag and drop — so it can handle multiple elements, and support keyboard interaction
Hi,
It looks like a lot of the code for sitepoint here on Gitbhub is MIT licensed. Is this particular code licensed under MIT as well?
Thanks,
-Rich
Hello,
first thanks for that demos that helped me for a project.
Based on demo4a code I found that it is possible to include HTML stuff within the li: it is well displayed.
BUT: it can only be selected/grabbed when cliking on pure text, not on (let say) bold or italic parts.
It is because the (let say) bold element is recieved in document.addEventListener and it don't have the draggable attribute. I changed this function in that way:
// for HTML content in the li the event comes for the that entity // if not pure text. try to reach li parent var tmp = e.target; while (tmp.nodeName != "LI") { tmp = tmp.parentElement; }
and then replace e.target by tmp in the following code (if(tmp.getAttribute('draggable'))
and tmp.getAttribute('aria-grabbed') == 'false'
).
It works fine for me (li are selectable everywhere) and draggable.
You may consider inserting it, probably after improving it.
Note: this code doesn't cover the multi-selection case. If you select as 2nd (or more) element a line by clicking a HTMLed part it is ignored. The same changes should be applied somewhere else.
Regards,
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.