react-spectrum
react-spectrum copied to clipboard
Can't add a draggable button in column headers
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.
Sorry, but it looks like the sandbox link is broken?
I don't understand codesandbox and why the live link got removed. https://codesandbox.io/p/devbox/laughing-mirzakhani-25fyt7 hopefully this is working
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..
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.
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?