[#61546] Fix DangerDialog scroll behaviour w/form#243
Conversation
🦋 Changeset detectedLatest commit: 79986c4 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
ec2b87e to
7e82261
Compare
aa861ec to
5c45a6f
Compare
| if (this.form) { | ||
| this.form.style.display = 'contents' | ||
| } |
There was a problem hiding this comment.
I've noticed that this could be considered an anti-pattern. However I'm not sure if the note in the Catalyst docs refers to children that might be appended dynamically at a later point or those present in the DOM at the time connectedCallback() is invoked.
There was a problem hiding this comment.
I agree, that feels like a smell. I am not a fan of setting styles via JS anyway. Couldn't we set a class on the form and solve it in CSS?
There was a problem hiding this comment.
I am not a fan of setting styles via JS anyway.
I generally agree - at least with regards to visual styling. Although when the style is more "behavioural", I think it can be ok to apply the styles directly - e.g. <scrollable-region> web component.
There was a problem hiding this comment.
Yeah, that makes sense. Fine for me then 👍
There was a problem hiding this comment.
Now that I think of it, we might run into problems because of what you quoted above.. We could avoid that by applying a class directly in the component. So we don't have to rely on the timing to be correct..
HDinger
left a comment
There was a problem hiding this comment.
I think I managed to run into the error that the form was not present yet when the connectedCallback was called. I guess, applying a class in the constructor via the @form_arguments is probably safer.
5c45a6f to
79986c4
Compare

What are you trying to accomplish?
Fix Danger Dialog scroll behaviour when the dialog contains a form.
Note on using Form Builders
N.B. this issue only occurs when the `form` element is rendered inside the dialog, which in turn only happens when an `action` rather than `builder` is passed as `form_arguments`.
https://qa.openproject-edge.com/lookbook/inspect/primer/open_project/danger_dialog/with_form (incorrect scroll behaviour)
https://qa.openproject-edge.com/lookbook/inspect/primer/open_project/danger_dialog/with_form_builder_form (behaves as expected)
Screenshots
Before
After
Integration
No changes necessary.
List the issues that this change affects.
https://community.openproject.org/wp/61546
Risk Assessment
What approach did you choose and why?
This PR also applies
display: contentsto theformelement when present.See commit 10e03e7 (PR #234)
Anything you want to highlight for special attention from reviewers?
N/A
Accessibility
Merge checklist