Skip to content

Commit

Permalink
Fix submit of bookmark editor (#728)
Browse files Browse the repository at this point in the history
  • Loading branch information
int128 committed Jun 23, 2024
1 parent 93ff799 commit 2e224a5
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
3 changes: 2 additions & 1 deletion src/BookmarkEditor/component.css
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
dialog.BookmarkEditor {
width: auto;
max-width: 800px;
padding: var(--size-wide-gap);
padding: inherit;
color: inherit;
background-color: var(--palette-3);
border-style: none;
Expand All @@ -22,6 +22,7 @@ dialog.BookmarkEditor::backdrop {
.BookmarkEditor__Form {
display: grid;
gap: var(--size-gap);
padding: var(--size-wide-gap);
}

.BookmarkEditor__Group {
Expand Down
9 changes: 2 additions & 7 deletions src/Dialog/component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,8 @@ const DialogComponent: FC<DialogComponentProps> = ({ children, open, onRequestCl
className={className}
onCancel={onRequestClose}
onClick={(e) => {
if (dialogRef.current === null) {
return
}
if (!isClickedInRect(e, dialogRef.current.getBoundingClientRect())) {
// Close the dialog when the backdrop is clicked
if (e.target === dialogRef.current) {
onRequestClose()
}
}}
Expand All @@ -46,6 +44,3 @@ const DialogComponent: FC<DialogComponentProps> = ({ children, open, onRequestCl
}

export default DialogComponent

const isClickedInRect = (e: React.MouseEvent, r: DOMRect): boolean =>
e.clientX > r.left && e.clientX < r.right && e.clientY > r.top && e.clientY < r.bottom
3 changes: 2 additions & 1 deletion src/Preferences/component.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
}

dialog.Preferences {
padding: var(--size-wide-gap);
padding: inherit;
color: inherit;
background-color: var(--palette-3);
border-style: none;
Expand All @@ -20,6 +20,7 @@ dialog.Preferences::backdrop {
.Preferences__Form {
display: grid;
gap: var(--size-gap);
padding: var(--size-wide-gap);
}

.Preferences h2 {
Expand Down

0 comments on commit 2e224a5

Please sign in to comment.