Skip to content

fix(module:modal): remove dark backdrop when nzMask is false#8798

Merged
Laffery merged 1 commit intoNG-ZORRO:masterfrom
withOutUndo:master
Oct 22, 2024
Merged

fix(module:modal): remove dark backdrop when nzMask is false#8798
Laffery merged 1 commit intoNG-ZORRO:masterfrom
withOutUndo:master

Conversation

@withOutUndo
Copy link
Copy Markdown
Contributor

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Application (the showcase website) / infrastructure changes
  • Other... Please describe:

What is the current behavior?

Issue Number: N/A

What is the new behavior?

Does this PR introduce a breaking change?

  • Yes
  • No

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.

@codecov
Copy link
Copy Markdown

codecov bot commented Sep 26, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.92%. Comparing base (4f536ce) to head (b5ab04a).
Report is 25 commits behind head on master.

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     
Flag Coverage Δ
?

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Comment on lines 135 to +137
hasBackdrop: true,
scrollStrategy: this.overlay.scrollStrategies.block(),
backdropClass: getValueWithConfig(config.nzMask, globalConfig.nzMask, true) ? MODAL_MASK_CLASS_NAME : '',
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
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(),

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Sure, I've resubmitted the code, please take a look.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

There is a test that failed, can you take a look?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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 : ''
}

Copy link
Copy Markdown
Collaborator

@HyperLife1119 HyperLife1119 left a comment

Choose a reason for hiding this comment

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

LGTM

@Laffery Laffery merged commit f2f04fe into NG-ZORRO:master Oct 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants