Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make modal backdrop dismiss configurable #3191

Closed
wants to merge 3 commits into from
Closed

Make modal backdrop dismiss configurable #3191

wants to merge 3 commits into from

Conversation

Tobias-Secher
Copy link

@Tobias-Secher Tobias-Secher commented Jul 31, 2023

Which issue does this PR close?

This PR closes #3162

What is the new behavior?

Does this PR introduce a breaking change?

  • Yes
  • No

Are there any additional context?

Checklist:

The following tasks should be carried out in sequence in order to follow the process of contributing correctly.

Reminders

  • Make sure you have implemented tests following the guidelines in: "The good: Test".
  • Make sure you have updated the cookbook with examples and showcases (for bug fixes, enhancements & new components).

Review

  • Determine if your changes are a fix, feature or breaking-change, and add the matching label to your PR. If it is tooling, dependency updates or similar, add ignore-for-release.
  • Do a self-review.
  • Request that the changes are code-reviewed
  • Request that the changes are UX reviewed (only necessary if your PR introduces visual changes)

When the pull request has been approved it will be merged to develop by Team Kirby.

@RasmusKjeldgaard RasmusKjeldgaard changed the title Enhancement 3162 modal backdrop dismiss configurable Make modal backdrop dismiss configurable Aug 9, 2023
Copy link
Collaborator

@RasmusKjeldgaard RasmusKjeldgaard left a comment

Choose a reason for hiding this comment

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

Thanks for your contribution and good suggestion!
I've added a couple of suggestions that will most likely have consequences for the tests, so I will await your responses before looking at the spec.

{
name: 'backdropDismiss',
description: `(Optional) Modal will close on backdrop click`,
defaultValue: 'undefined',
Copy link
Collaborator

@RasmusKjeldgaard RasmusKjeldgaard Aug 9, 2023

Choose a reason for hiding this comment

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

Even if not technically true, I would describe the default value as true here. This is what Ionics default value is on the modal, and thus how our modal behaves out of the box.

@@ -24,6 +24,7 @@ export interface ModalConfig {
// drawer properties
interactWithBackground?: boolean;
cssClass?: string | string[];
backdropDismiss?: boolean;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Consider moving this to line 22 for readability

@@ -74,6 +74,7 @@ export class ModalExampleSimpleComponent implements OnInit {
showNestedOptions: true,
showDummyContent: false,
showModalSizeSelector: true,
backdropDismiss: false,
Copy link
Collaborator

Choose a reason for hiding this comment

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

I believe this should be added as a part of the overall config, not part of the componentProps, for this to work.

But more importantly I think this should be added to the advanced use-cases example instead of here and also be exposed as a config option on that example:
image

return config.backdropDismiss;
}

return config.flavor === 'compact' || config.interactWithBackground ? false : true;
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this should be refactored so these are the first checks. We do not want people to be able to overwrite backdropDismiss for compact or interactWithBackground scenarios :)

@RasmusKjeldgaard
Copy link
Collaborator

Together with @Tobias-Secher and team it has been determined (from a usability standpoint) that we do not wish to support this feature, and I know that they ended up with a better solution by using the alertBeforeClose functionality of the modal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Enhancement] Modal backdropDismiss should be configurable
2 participants