Skip to content

Commit b03692a

Browse files
authored
fix(Table): set sort type button to prevent form submit (#2402)
1 parent dda5b21 commit b03692a

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

.changeset/pretty-dancers-taste.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@digdir/designsystemet-react": patch
3+
---
4+
5+
Table: Set sort button type to prevent form submit

packages/react/src/components/Table/TableHeaderCell.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,13 @@ export const TableHeaderCell = forwardRef<
1515
>(function TableHeaderCell({ sort, children, ...rest }, ref) {
1616
return (
1717
<th aria-sort={sort} ref={ref} {...rest}>
18-
{sort ? <button className='ds-focus'>{children}</button> : children}
18+
{sort ? (
19+
<button type='button' className='ds-focus'>
20+
{children}
21+
</button>
22+
) : (
23+
children
24+
)}
1925
</th>
2026
);
2127
});

0 commit comments

Comments
 (0)