dnd-kit icon indicating copy to clipboard operation
dnd-kit copied to clipboard

Should role="button" be present when using a handle?

Open avigoldman opened this issue 3 years ago • 4 comments

When using a handle should the draggable item still have a role="button" attribute?

Example: https://5fc05e08a4a65d0021ae0bf2-mdsmdaavqx.chromatic.com/?path=/story/presets-sortable-vertical--drag-handle

Thanks for the awesome library!

avigoldman avatar Aug 06 '21 19:08 avigoldman

This can cause a problem when a global CSS applies on [role=button], with handle I think the role should be removed too.

Grafikart avatar Jan 05 '22 14:01 Grafikart

This also can give an HTML error of type 'An element "input" must not appear as a descendant of an element with the attribute "role=button"', if you're planing on using an input element inside the draggable item.

Robertron624 avatar Jun 06 '23 14:06 Robertron624

Just ran into this as well when using on sortable table column headers. Disabled = true and role = button still being spread from {...attributes} which is causing hover styling from our global [type=button] styles. Who is appropriate person to tag on project to get this sorted (pun intended)?

jake-chapman-mark43 avatar Mar 06 '24 17:03 jake-chapman-mark43