admin管理员组文章数量:1277896
I am using two different dnd kit DndContext
providers in a table. One to rearrange the columns of the header, one to drag & drop rows.
Now I get a console error that divs are not allowed as children in a thead
/tbody
.
The problem is, the DndContext
for some reason renders divs into the thead
:
<thead className="sticky top-0 bg-white z-10">
<tr id="table-headers_0" className="group">
<th>Size</th>
<th>File name</th>
</tr>
<div id="DndDescribedBy-5" style="display: none;">
To pick up a draggable item, press the space bar.
While dragging, use the arrow keys to move the item.
Press space again to drop the item in its new position, or press escape to cancel.
</div>
<div id="DndLiveRegion-3" role="status" aria-live="assertive" aria-atomic="true"
style="position: fixed; top: 0px; left: 0px; width: 1px; height: 1px; margin: -1px; border: 0px; padding: 0px; overflow: hidden; clip: rect(0px, 0px, 0px, 0px); clip-path: inset(100%); white-space: nowrap;"></div>
</thead>
My corresponding code:
<thead>
<DndContext
collisionDetection={closestCenter}
modifiers={[restrictToHorizontalAxis]}
onDragEnd={handleThDragEnd}
sensors={sensors}>
{table.getHeaderGroups().map(({id, headers}) => (
<tr>
{headers.map(header => {
const {id, column, getContext} = header;
return (
<SortableContext
key={id}
items={columnOrder}
strategy={horizontalListSortingStrategy}>
<th
{flexRender(column.columnDef.header, getContext())}
</th>
</SortableContext>
...
Does anyone know how I can get it to not render the divs?
本文标签: reactjsHow to stop DND Kit from rendering divsStack Overflow
版权声明:本文标题:reactjs - How to stop DND Kit from rendering divs - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741219127a2360626.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论