Skip to content

Commit b9cbcd7

Browse files
committed
fix: Interacting form submits early
1 parent 2df135f commit b9cbcd7

File tree

16 files changed

+74
-25
lines changed

16 files changed

+74
-25
lines changed

.eslintrc.json

Lines changed: 56 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
{
22
"root": true,
3-
"ignorePatterns": ["!.storybook"],
3+
"ignorePatterns": [
4+
"!.storybook"
5+
],
46
"parserOptions": {
57
"sourceType": "module",
68
"ecmaVersion": "latest"
@@ -18,19 +20,42 @@
1820
"ignoreRestSiblings": true
1921
}
2022
],
21-
"import/extensions": ["error", "ignorePackages"],
22-
"import/no-duplicates": ["error", { "prefer-inline": true }],
23+
"import/extensions": [
24+
"error",
25+
"ignorePackages"
26+
],
27+
"import/no-duplicates": [
28+
"error",
29+
{
30+
"prefer-inline": true
31+
}
32+
],
2333
"simple-import-sort/imports": [
2434
"error",
2535
{
2636
"groups": [
27-
["^\\u0000"],
28-
["^node:"],
29-
["^@?\\w"],
30-
["^@seamapi/react/"],
31-
["^fixtures/", "^lib/"],
32-
["^"],
33-
["^\\."]
37+
[
38+
"^\\u0000"
39+
],
40+
[
41+
"^node:"
42+
],
43+
[
44+
"^@?\\w"
45+
],
46+
[
47+
"^@seamapi/react/"
48+
],
49+
[
50+
"^fixtures/",
51+
"^lib/"
52+
],
53+
[
54+
"^"
55+
],
56+
[
57+
"^\\."
58+
]
3459
]
3560
}
3661
],
@@ -39,11 +64,21 @@
3964
},
4065
"overrides": [
4166
{
42-
"files": ["*.js", "*.mjs", "*.cjs"],
43-
"extends": ["standard", "prettier"]
67+
"files": [
68+
"*.js",
69+
"*.mjs",
70+
"*.cjs"
71+
],
72+
"extends": [
73+
"standard",
74+
"prettier"
75+
]
4476
},
4577
{
46-
"files": ["*.ts", "*.tsx"],
78+
"files": [
79+
"*.ts",
80+
"*.tsx"
81+
],
4782
"extends": [
4883
"standard-with-typescript",
4984
"standard-jsx",
@@ -52,7 +87,10 @@
5287
"plugin:storybook/recommended",
5388
"prettier"
5489
],
55-
"plugins": ["simple-import-sort", "unused-imports"],
90+
"plugins": [
91+
"simple-import-sort",
92+
"unused-imports"
93+
],
5694
"parserOptions": {
5795
"project": "./tsconfig.json"
5896
},
@@ -70,12 +108,14 @@
70108
},
71109
"overrides": [
72110
{
73-
"files": ["**/*.stories.tsx"],
111+
"files": [
112+
"**/*.stories.tsx"
113+
],
74114
"rules": {
75115
"react-hooks/rules-of-hooks": "off"
76116
}
77117
}
78118
]
79119
}
80120
]
81-
}
121+
}

src/lib/seam/components/SupportedDeviceTable/FilterCategoryMenu.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export function FilterCategoryMenu({
4646
<p>{label}</p>
4747
<Menu
4848
renderButton={({ onOpen }) => (
49-
<button onClick={onOpen}>
49+
<button type='button' onClick={onOpen}>
5050
<span>{buttonLabel}</span>
5151
<ChevronDownIcon />
5252
</button>

src/lib/seam/components/SupportedDeviceTable/ShowAllDevicesButton.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export function ShowAllDevicesButton({
2020
const label = expanded ? t.showLess : t.showAll(totalDeviceCount)
2121

2222
return (
23-
<button className='show-all-devices-button' onClick={onClick}>
23+
<button type='button' className='show-all-devices-button' onClick={onClick}>
2424
<ChevronRightIcon /> {label}
2525
</button>
2626
)

src/lib/ui/Alert/Alert.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ function Action(props: ActionProps): JSX.Element | null {
4949

5050
return (
5151
<div className='seam-alert-action-wrap'>
52-
<button onClick={handleClick} className='seam-alert-action'>
52+
<button type='button' onClick={handleClick} className='seam-alert-action'>
5353
{props.label}
5454
</button>
5555
</div>

src/lib/ui/IconButton.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ export function IconButton({
1515
return (
1616
<button
1717
{...props}
18+
type='button'
1819
ref={elRef}
1920
className={classNames(
2021
'seam-icon-btn',

src/lib/ui/Snackbar/Snackbar.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ export function Snackbar({
7777
<div className='seam-snackbar-actions-wrap'>
7878
{action != null && (
7979
<button
80+
type='button'
8081
className='seam-snackbar-action'
8182
onClick={handleActionClick}
8283
>
@@ -85,6 +86,7 @@ export function Snackbar({
8586
)}
8687
{!disableCloseButton && (
8788
<button
89+
type='button'
8890
className='seam-snackbar-close-button'
8991
onClick={() => {
9092
handleClose()

src/lib/ui/TabSet.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ function TabButton<TabType extends string>({
102102
'seam-tab-button',
103103
isActive && 'seam-tab-button-active'
104104
)}
105+
type='button'
105106
onClick={handleClick}
106107
>
107108
<p className='seam-tab-button-label'>{title}</p>

src/lib/ui/TextButton.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ export function TextButton({
1010
...buttonProps
1111
}: TextButtonProps): JSX.Element {
1212
return (
13-
<button className={`seam-text-btn seam-color-${color}`} {...buttonProps} />
13+
<button type='button' className={`seam-text-btn seam-color-${color}`} {...buttonProps} />
1414
)
1515
}

src/lib/ui/TextField/TextField.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ export const TextField = forwardRef<
105105
<div className='seam-adornment seam-end'>
106106
{clearable && (
107107
<button
108+
type='button'
108109
className={classNames({
109110
'seam-hidden': valueIsEmpty,
110111
})}

src/lib/ui/Tooltip/Tooltip.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export function Tooltip({ children }: PropsWithChildren): JSX.Element {
4040
return (
4141
<div className='seam-tooltip'>
4242
<div className='seam-tooltip-trigger-wrap'>
43-
<button onClick={handleToggle} className='seam-tooltip-button'>
43+
<button type='button' onClick={handleToggle} className='seam-tooltip-button'>
4444
<div className='seam-tooltip-button-icon seam-tooltip-button-icon-default'>
4545
<InfoIcon />
4646
</div>

0 commit comments

Comments
 (0)