Skip to content

[#61546] Fix DangerDialog scroll behaviour w/form#243

Merged
HDinger merged 2 commits intomainfrom
fix/61546-danger-dialog-scroll-behaviour
Feb 20, 2025
Merged

[#61546] Fix DangerDialog scroll behaviour w/form#243
HDinger merged 2 commits intomainfrom
fix/61546-danger-dialog-scroll-behaviour

Conversation

@myabc
Copy link
Collaborator

@myabc myabc commented Feb 17, 2025

⚠️ See #244 for system tests for this bugfix

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

Before fix

After

After fix

Integration

No changes necessary.

List the issues that this change affects.

https://community.openproject.org/wp/61546

Risk Assessment

  • Low risk the change is small, highly observable, and easily rolled back.
  • Medium risk changes that are isolated, reduced in scope or could impact few users. The change will not impact library availability.
  • High risk changes are those that could impact customers and SLOs, low or no test coverage, low observability, or slow to rollback.

What approach did you choose and why?

This PR also applies display: contents to the form element when present.

See commit 10e03e7 (PR #234)

Anything you want to highlight for special attention from reviewers?

N/A

Accessibility

  • Fixes axe scan violation - This change fixes an existing axe scan violation.
  • No new axe scan violation - This change does not introduce any new axe scan violations.
  • New axe violation - This change introduces a new axe scan violation. Please describe why the violation cannot be resolved below.

Merge checklist

  • Added/updated tests
  • Added/updated documentation
  • Added/updated previews (Lookbook)
  • Tested in Chrome
  • Tested in Firefox
  • Tested in Safari
  • Tested in Edge

@changeset-bot
Copy link

changeset-bot bot commented Feb 17, 2025

🦋 Changeset detected

Latest commit: 79986c4

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@openproject/primer-view-components Patch

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

@myabc myabc force-pushed the fix/61546-danger-dialog-scroll-behaviour branch from ec2b87e to 7e82261 Compare February 19, 2025 00:10
@myabc myabc requested a review from HDinger February 19, 2025 00:12
@myabc myabc added the bug Something isn't working label Feb 19, 2025
@myabc
Copy link
Collaborator Author

myabc commented Feb 19, 2025

@HDinger in order to unblock this for review and merging, I've split the system tests out into a separate PR - #244.

@myabc myabc marked this pull request as ready for review February 19, 2025 00:30
@myabc myabc force-pushed the fix/61546-danger-dialog-scroll-behaviour branch from aa861ec to 5c45a6f Compare February 19, 2025 00:31
Comment on lines +19 to +23
if (this.form) {
this.form.style.display = 'contents'
}
Copy link
Collaborator Author

@myabc myabc Feb 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

image

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Collaborator Author

@myabc myabc Feb 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that makes sense. Fine for me then 👍

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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..

Copy link
Collaborator

@HDinger HDinger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Also applies `display: contents` to the `form` element when present.

See commit 10e03e7
(PR #234)
@myabc myabc force-pushed the fix/61546-danger-dialog-scroll-behaviour branch from 5c45a6f to 79986c4 Compare February 20, 2025 12:19
@HDinger HDinger merged commit 35a25fe into main Feb 20, 2025
33 checks passed
@HDinger HDinger deleted the fix/61546-danger-dialog-scroll-behaviour branch February 20, 2025 12:39
@openprojectci openprojectci mentioned this pull request Feb 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working patch release

Development

Successfully merging this pull request may close these issues.

2 participants