craft.js
craft.js copied to clipboard
isDeletable is inadequate - or just plain wrong.
Describe the bug
The docs imply that craft.rules.canMoveOut
can be used as a test for being deletable, but it is only called on dragging.
The isDeletable
function will return true
as long as it's not the root node or a top-level node, which is probably inconsistent with the canMoveOut
rule.
To Reproduce Steps to reproduce the behavior:
- go to the landing page demo at https://craft.js.org/
- try to drag the sole button out of the Custom3 "I must have 1 button" section, you cannot
- now click the trashcan in the toolbar - the button is deleted
Expected behavior If you can't drag a component out, you should not be able to delete it.
Screenshots
Additional context Since drag and drop is problematic for keyboard only users, this is an accessibility issue as well.
Your environment
Software | Version(s) |
---|---|
craft.js | 0.2.6 |
React | |
TypeScript | |
Browser | |
npm/Yarn | |
Operating System |