UNPKG

react-dnd-accessible-backend

Version:

An add-on backend for react-dnd that provides support for keyboards and screenreaders by default.

12 lines 806 B
export default function isKeyboardDragTrigger(event, withUntrusted = false) { // VERY HACK(faulty): react-dnd-multi-backend fires a "cloned event" after // transitioning backends. But, that event is only a base Event, not a specialized // KeyboardEvent or MouseEvent, so it doesn't have any of the `.key`, `.metaKey`, // etc. properties on it. Because of that, knowing that this is a trigger can // only be done by looking at the `isTrusted` property, which is false for // custom-constructed events. Eventually, rdmb should fire an appropriate event instead. if (withUntrusted && event.isTrusted === false) return true; return event.key?.toLowerCase() === "d" && (event.metaKey || event.ctrlKey) && !event.altKey; } //# sourceMappingURL=isKeyboardDragTrigger.js.map