feat(dialog):弹窗关闭后再次显示弹窗单击背景动画修改#8181
Open
Tony-ST0754 wants to merge 3 commits into
Open
Conversation
refactor:由于 Bootstrap 里面有bug,第一次点击背景层时,会自动加上 modal-static,但窗口关闭后再次显示点击背景时并没有自动加上 modal-static,因此在组件中手动处理该逻辑
|
Thanks for your PR, @Tony-ST0754. Someone from the team will get assigned to your PR shortly and we'll get it reviewed. |
Contributor
Reviewer's GuideImplements a workaround for a Bootstrap modal bug by manually handling backdrop clicks to properly close the modal or trigger the static-backdrop animation on subsequent openings. Sequence diagram for modal backdrop click handling workaroundsequenceDiagram
actor User
participant ModalElement as ModalElement_div.modal
participant JsHandler as Modal_razor_js
participant BootstrapModal as Bootstrap_modal_instance
User->>ModalElement: click
ModalElement->>JsHandler: click event listener
JsHandler->>JsHandler: [e.target === el && has classes modal,fade,show]
alt [backdrop !== static]
JsHandler->>ModalElement: EventHandler.off click
JsHandler->>BootstrapModal: modal.close()
else [backdrop === static]
JsHandler->>ModalElement: classList.add modal-static
JsHandler->>ModalElement: style.overflowY = hide
JsHandler->>JsHandler: setTimeout 300ms
JsHandler->>ModalElement: classList.remove modal-static
JsHandler->>ModalElement: style.overflowY = ""
end
File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Contributor
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- The click listener is attached with
el.addEventListener('click', ...)but later removed viaEventHandler.off(el, 'click'), which won’t detach this handler; consider usingremoveEventListeneror a shared handler reference to avoid accumulating multiple listeners across inits. - In the static backdrop branch,
e.target.style.overflowY = 'hide';uses a non-standard value and will be ignored by the browser; this should likely be'hidden'to match Bootstrap’s behavior.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The click listener is attached with `el.addEventListener('click', ...)` but later removed via `EventHandler.off(el, 'click')`, which won’t detach this handler; consider using `removeEventListener` or a shared handler reference to avoid accumulating multiple listeners across inits.
- In the static backdrop branch, `e.target.style.overflowY = 'hide';` uses a non-standard value and will be ignored by the browser; this should likely be `'hidden'` to match Bootstrap’s behavior.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #8181 +/- ##
=======================================
Coverage 98.78% 98.79%
=======================================
Files 766 766
Lines 34221 34221
Branches 4699 4699
=======================================
+ Hits 33806 33807 +1
+ Partials 415 414 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
refactor:补充多层弹窗单击背景效果
fixed:修正overflowY属性值设置错误
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Link issues
fixes #8176
根本原因 / Root Cause
由于 Bootstrap 里面有bug,第一次点击背景层时,会自动加上 modal-static,但窗口关闭后再次显示点击背景时并没有自动加上 modal-static,因此在组件中手动处理该逻辑
第一次单击背景时会自动如下
关闭弹窗后,再次显示弹窗,单击背景时会自动如下
解决方案 / Solution
由于是
Bootstrap内部的bug,因此要不等Bootstrap修复bug后,BB组件更新,要么在BB组件内部自行处理监听单击背景的Click事件中处理Summary By Copilot
Regression?
Risk
Verification
Packaging changes reviewed?
☑️ Self Check before Merge
Summary by Sourcery
Handle modal backdrop clicks to work around a Bootstrap bug affecting repeated dialog openings.
Bug Fixes:
Enhancements: