fix(module:modal): remove dark backdrop when nzMask is false#8798
fix(module:modal): remove dark backdrop when nzMask is false#8798Laffery merged 1 commit intoNG-ZORRO:masterfrom
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #8798 +/- ##
==========================================
- Coverage 93.24% 91.92% -1.32%
==========================================
Files 537 537
Lines 18456 18455 -1
Branches 2816 2816
==========================================
- Hits 17209 16965 -244
+ Misses 1209 1184 -25
- Partials 38 306 +268
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
| hasBackdrop: true, | ||
| scrollStrategy: this.overlay.scrollStrategies.block(), | ||
| backdropClass: getValueWithConfig(config.nzMask, globalConfig.nzMask, true) ? MODAL_MASK_CLASS_NAME : '', |
There was a problem hiding this comment.
| hasBackdrop: true, | |
| scrollStrategy: this.overlay.scrollStrategies.block(), | |
| backdropClass: getValueWithConfig(config.nzMask, globalConfig.nzMask, true) ? MODAL_MASK_CLASS_NAME : '', | |
| hasBackdrop: getValueWithConfig(config.nzMask, globalConfig.nzMask, true), | |
| scrollStrategy: this.overlay.scrollStrategies.block(), |
There was a problem hiding this comment.
Sure, I've resubmitted the code, please take a look.
There was a problem hiding this comment.
There is a test that failed, can you take a look?
There was a problem hiding this comment.
In the test cases, there is a dynamic modification of the global configuration nzMask, but the CDK overlay does not have an API to dynamically add or remove the backdrop, so it cannot satisfy all test cases. Therefore, it was modified to
{
hasBackdrop: true,
backdropClass: getValueWithConfig(config.nzMask, globalConfig.nzMask, true) ? MODAL_MASK_CLASS_NAME : ''
}
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Issue Number: N/A
What is the new behavior?
Does this PR introduce a breaking change?
Other information
In Angular CDK Overlay, if backdropClass is not set, the default is 'cdk-overlay-dark-backdrop', which causes a black background even when nzMask is set to false. Therefore, set the default value based on the value of nzMask.