Skip to content

Commit

Permalink
fix(link-dialog): stop button submit event propagation
Browse files Browse the repository at this point in the history
  • Loading branch information
theoludwig authored and petyosi committed Sep 12, 2023
1 parent e796cbe commit 8f04486
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/plugins/link-dialog/LinkDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ export function LinkEditForm({ initialUrl, initialTitle, onSubmit, onCancel, lin
[isOpen, items, onSubmit, title]
)

const handleSaveClick = (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => {
event.stopPropagation()
}

const downshiftInputProps = getInputProps()

const inputProps = {
Expand Down Expand Up @@ -126,7 +130,7 @@ export function LinkEditForm({ initialUrl, initialTitle, onSubmit, onCancel, lin
<button type="reset" title="Cancel change" aria-label="Cancel change" className={classNames(styles.secondaryButton)}>
Cancel
</button>
<button type="submit" title="Set URL" aria-label="Set URL" className={classNames(styles.primaryButton)}>
<button type="submit" title="Set URL" aria-label="Set URL" className={classNames(styles.primaryButton)} onClick={handleSaveClick}>
Save
</button>
</div>
Expand Down

0 comments on commit 8f04486

Please sign in to comment.