Skip to content

Commit 35a25fe

Browse files
authored
Merge pull request #243 from opf/fix/61546-danger-dialog-scroll-behaviour
[#61546] Fix DangerDialog scroll behaviour w/form
2 parents efe1579 + 79986c4 commit 35a25fe

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

.changeset/soft-pots-return.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@openproject/primer-view-components': patch
3+
---
4+
5+
Fix DangerDialog body scroll behaviour when containing a form: the dialog's confirm and cancel buttons should now always be visible in the viewport, never scrolling with the other dialog content.

app/components/primer/open_project/danger_dialog_form_helper.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,21 @@ const SUBMIT_BUTTON_SELECTOR = 'input[type=submit],button[type=submit],button[da
66
class DangerDialogFormHelperElement extends HTMLElement {
77
@target checkbox: HTMLInputElement | undefined
88

9+
get form() {
10+
return this.querySelector('form')
11+
}
12+
913
get submitButton() {
1014
return this.querySelector<HTMLInputElement | HTMLButtonElement>(SUBMIT_BUTTON_SELECTOR)!
1115
}
1216

1317
connectedCallback() {
18+
// makes the custom element behave as if it doesn't exist in the DOM structure, passing all
19+
// styles directly to its children.
1420
this.style.display = 'contents'
21+
if (this.form) {
22+
this.form.style.display = 'contents'
23+
}
1524
this.#reset()
1625
}
1726

0 commit comments

Comments
 (0)