Skip to content

Commit

Permalink
fix(Table): set sort type button to prevent form submit (#2402)
Browse files Browse the repository at this point in the history
  • Loading branch information
eirikbacker authored Sep 12, 2024
1 parent dda5b21 commit b03692a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/pretty-dancers-taste.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@digdir/designsystemet-react": patch
---

Table: Set sort button type to prevent form submit
8 changes: 7 additions & 1 deletion packages/react/src/components/Table/TableHeaderCell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,13 @@ export const TableHeaderCell = forwardRef<
>(function TableHeaderCell({ sort, children, ...rest }, ref) {
return (
<th aria-sort={sort} ref={ref} {...rest}>
{sort ? <button className='ds-focus'>{children}</button> : children}
{sort ? (
<button type='button' className='ds-focus'>
{children}
</button>
) : (
children
)}
</th>
);
});

0 comments on commit b03692a

Please sign in to comment.