Closed rjtormis closed 8 months ago
When a tag is removed the cursor is shifted to the input automatically so that focus remains within the context of the component rather than being lost and defaulting to the document. I can see how this behaviour may not always be ideal, do you have any suggestions for how this could be improved?
I managed to find a way by adding onShouldCollapse. I'm not sure if this is the right way but temporarily this is my implementation
const handleShouldExpand = useCallback(() => {
if (hidden) {
setHidden(false);
return false;
}
return true;
}, [hidden]);
utilize some useState here which is triggered by onDelete callback
const handleRemoveDocsLink = useCallback(
(tagIndex: number) => {
setHidden(true);
setSelected(selected.filter((_: any, i: number) => i !== tagIndex));
},
[selected]
);
Is there any way to disable the listbox when the user wants to remove the tags? Whenever a user (lets say its me) want to remove a particular tag the listbox automatically appears.