selecto icon indicating copy to clipboard operation
selecto copied to clipboard

How to support keyboard shortcuts? (react-selecto)

Open tomelliot opened this issue 1 year ago • 2 comments

I'm trying to add keyboard shortcuts (like select-all ("meta+a"), select-none ("esc")) in a react-selecto instance.

Is there a way to handle this with Selecto? Currently I don't see a way - the onSelect handler ends up with a state mismatch, because there's no hook for synchronising internal state with external state.

tomelliot avatar Jun 11 '24 10:06 tomelliot

try react-selectable-box

linxianxi avatar Aug 08 '24 07:08 linxianxi

@tomelliot I was able to do this by putting a ref of the selectable elements then using selecto ref to set the selection.

selectoRef.current?.setSelectedTargets(
      listOfIds.map((id) => refMap.current[id]?.parentElement!)
    );

jamesonhill avatar Aug 06 '25 18:08 jamesonhill