react-spectrum icon indicating copy to clipboard operation
react-spectrum copied to clipboard

Can't add a draggable button in column headers

Open snowystinger opened this issue 1 year ago • 5 comments

Discussed in https://github.com/adobe/react-spectrum/discussions/6191

Originally posted by bu3alwa April 12, 2024 I made a sandbox and issue is when you add the drag button in the column it does not trigger on the column. Is this a bug? I understand this feature that is not provided but I would think I would be able to extend columns to implement my own features.

https://codesandbox.io/p/live/d531fedb-93b3-4612-90ae-f8c6009e2aaf

Possible fix

It looks like this usePress is the culprit https://github.com/adobe/react-spectrum/blob/main/packages/%40react-aria/table/src/useTableColumnHeader.ts#L52 It calls some preventDefaults/stopPropagations which are likely interferring.

I have a vague memory of not applying the returned value from usePress when it should be disabled, but, that caused a different problem. Someone will have to try that out and see if it causes any issues.

snowystinger avatar Apr 12 '24 00:04 snowystinger

Sorry, but it looks like the sandbox link is broken?

Screenshot 2024-04-12 at 11 59 33 PM

sookmax avatar Apr 12 '24 15:04 sookmax

I don't understand codesandbox and why the live link got removed. https://codesandbox.io/p/devbox/laughing-mirzakhani-25fyt7 hopefully this is working

bu3alwa avatar Apr 12 '24 16:04 bu3alwa

I don't understand codesandbox and why the live link got removed. https://codesandbox.io/p/devbox/laughing-mirzakhani-25fyt7 hopefully this is working

Sorry but this doesn't work either, giving me 'Devbox not found' page..

sookmax avatar Apr 17 '24 13:04 sookmax

I don't understand codesandbox and why the live link got removed. https://codesandbox.io/p/devbox/laughing-mirzakhani-25fyt7 hopefully this is working

Sorry but this doesn't work either, giving me 'Devbox not found' page..

Sorry, try again now. I don't know why I am having so much trouble with this. Should be set to public now.

bu3alwa avatar Apr 17 '24 15:04 bu3alwa

I have a vague memory of not applying the returned value from usePress when it should be disabled, but, that caused a different problem. Someone will have to try that out and see if it causes any issues.

So I am just wondering. When you remove those props from usePress on that useTableColumnHeader then sorting won't be a feature that can be used correct? Would it be better to have a seperate hook useTableColumnSortButton and have that implement a button in the header?

bu3alwa avatar May 09 '24 00:05 bu3alwa