Skip to content

Conversation

gausszhou
Copy link

@gausszhou gausszhou commented Sep 13, 2025

PR

PR Checklist

Please check if your PR fulfills the following requirements:

  • The commit message follows our Commit Message Guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

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
  • Other... Please describe:

What is the current behavior?

Issue Number: #3636

What is the new behavior?

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

已通过 e2e 测试

image

Summary by CodeRabbit

  • New Features

    • Introduced a noAnimation prop to control popup modal animations. Set to true to disable animations; animations remain enabled by default.
  • Behavior Changes

    • Animation handling now respects noAnimation instead of the previous flag, ensuring consistent control: disabled when true, enabled when false or unset.

Copy link

coderabbitai bot commented Sep 13, 2025

Walkthrough

Replaced the modal animation control when opening a popup: the call to PopupManager.openModal now uses the inverse of a new noAnimation prop (!props.noAnimation) instead of props.modalFade. No exported API signatures were altered.

Changes

Cohort / File(s) Summary
Popup modal animation flag update
packages/vue-hooks/src/vue-popup.ts
Switched PopupManager.openModal 5th argument from props.modalFade to !props.noAnimation, changing animation enablement to be controlled by the inverse of noAnimation. No other logic changed.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant VC as Vue Component
  participant PM as PopupManager

  VC->>PM: openModal(id, zIndex, dom, modalClass, !noAnimation)
  Note over VC,PM: Animation is enabled when noAnimation is false/undefined<br/>and disabled when noAnimation is true
  PM-->>VC: Modal opened with specified animation setting
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

I hopped through code at twilight’s gleam,
Flipped a flag—so subtle, clean.
NoAnimation true? Then still we stay;
False or none? We fade and sway.
A tiny tweak, a softer scene—
Carrots compiled, the UI serene. 🥕✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title directly targets the bug addressed by the changeset—v-modal/dialog wrapper animation not working—and therefore summarizes the primary intent of the PR (adjusting modal animation control via props). It is slightly redundant and awkwardly phrased because it repeats "fix" and uses "is not working," but it remains on-topic and not misleading.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions bot added the bug Something isn't working label Sep 13, 2025
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (2)
packages/vue/src/dialog-box/src/pc.vue (1)

21-21: Prefer object-style class binding to avoid empty string entries

Use an object for the conditional class for clarity and to avoid adding a blank class when modal is false.

-      :class="['tiny-dialog-box__wrapper', dialogClass, modal ? 'has-modal' : '']"
+      :class="['tiny-dialog-box__wrapper', dialogClass, { 'has-modal': modal }]"
packages/theme/src/dialog-box/index.less (1)

38-41: Mask-on-wrapper looks good; consider alias + property specificity

  • Add an is-modal alias for consistency with existing is-* modifiers while keeping has-modal for backward compatibility.
  • Use background-color instead of background to avoid resetting other background-* properties.
-    &.has-modal {
-      background: var(--tv-DialogBox-mask-bg-color);
-    }
+    &.has-modal,
+    &.is-modal {
+      background-color: var(--tv-DialogBox-mask-bg-color);
+    }
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7284629 and a1f3a47.

📒 Files selected for processing (2)
  • packages/theme/src/dialog-box/index.less (1 hunks)
  • packages/vue/src/dialog-box/src/pc.vue (1 hunks)
🔇 Additional comments (1)
packages/theme/src/dialog-box/index.less (1)

38-41: Verify overlay layering with .v-modal

Since .v-modal still exists (now transparent), confirm click/close works as expected and that the wrapper’s fade animates the mask visually:

  • modal=true: clicking outside dialog closes.
  • modal=false: clicking outside doesn’t close.
  • With/without appendToBody and rightSlide.

If issues arise, consider lowering .v-modal z-index beneath the wrapper or disabling its pointer events.

@gausszhou gausszhou changed the title fix(dialog-box): fix dialog wrapper animation is not working [WIP]fix(dialog-box): fix dialog wrapper animation is not working Sep 13, 2025
@github-actions github-actions bot removed the bug Something isn't working label Sep 13, 2025
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (3)
packages/vue/src/dialog-box/src/pc.vue (3)

21-25: Non-modal UX: ensure wrapper doesn’t block page when modal=false.

If the wrapper covers the viewport regardless of modal, consider CSS ensuring only .is-modal creates a full-screen, pointer-catching layer (e.g., pointer-events: auto only when .is-modal, and .tiny-dialog-box keeps pointer-events: auto).

If needed, adjust theme CSS:

/* mask only when modal */
.tiny-dialog-box__wrapper:not(.is-modal) { background: transparent; pointer-events: none; }
.tiny-dialog-box__wrapper:not(.is-modal) .tiny-dialog-box { pointer-events: auto; }

27-47: Add dialog ARIA semantics.

Improve accessibility by declaring role and labelling when modal.

Apply:

-        <div
+        <div
           ref="dialog"
           v-show="visible"
           v-if="destroyOnClose ? visible : true"
           :class="[
             {
               'is-fullscreen': state.isFull,
               'is-center': center,
               'is-right-slide': rightSlide
             }
           ]"
           :style="state.style"
           class="tiny-dialog-box"
           data-tag="tiny-dialog-box"
           :data-dialog-box-draggable="draggable"
+          role="dialog"
+          :aria-modal="modal"
+          :aria-labelledby="title ? ('tiny-dialog-title-' + state.key) : undefined"
           :key="state.key"
         >
-          <div v-if="showHeader" ref="header" class="tiny-dialog-box__header" @mousedown="handleDrag">
+          <div v-if="showHeader" ref="header" class="tiny-dialog-box__header" @mousedown="handleDrag">
             <slot name="title">
-              <span class="tiny-dialog-box__title">{{ title }}</span>
+              <span class="tiny-dialog-box__title" :id="'tiny-dialog-title-' + state.key">{{ title }}</span>
             </slot>

21-21: Docs and tests follow-up.

Update docs to note mask now comes from .tiny-dialog-box__wrapper.is-modal. Add an e2e asserting:

  • modal=true → wrapper has is-modal, overlay animates, clicking mask closes (if enabled).
  • modal=false → no mask, underlying page remains interactive.
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a1f3a47 and 3611bfb.

📒 Files selected for processing (3)
  • packages/theme-saas/src/dialog-box/index.less (0 hunks)
  • packages/theme/src/dialog-box/index.less (1 hunks)
  • packages/vue/src/dialog-box/src/pc.vue (1 hunks)
💤 Files with no reviewable changes (1)
  • packages/theme-saas/src/dialog-box/index.less
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/theme/src/dialog-box/index.less
🔇 Additional comments (2)
packages/vue/src/dialog-box/src/pc.vue (2)

21-21: Good fix: move mask onto wrapper via is-modal.

Binding ['tiny-dialog-box__wrapper', dialogClass, { 'is-modal': modal }] aligns with theme changes and lets the wrapper’s transition animate the mask.


21-25: ```shell
#!/bin/bash
set -euo pipefail
echo "1) Search for modal-related symbols across .vue/.js/.ts files..."
rg -n -C3 -S -e 'v-modal' -e '.v-modal' -e 'PopupManager' -e 'modalAppendToBody' -e 'closeOnClickModal' -g '!node_modules' -g '/*.vue' -g '/.js' -g '**/.ts' -g '/*.jsx' -g '/*.tsx' || true

echo
echo "2) Show files under packages/vue/src/dialog-box to confirm paths..."
rg -n -S --hidden -g 'packages/vue/' -g 'packages//dialog-box/**' -e '' || true

echo
echo "3) Print packages/vue/src/dialog-box/src/pc.vue (lines 1-240) if it exists..."
if [ -f "packages/vue/src/dialog-box/src/pc.vue" ]; then
sed -n '1,240p' packages/vue/src/dialog-box/src/pc.vue || true
else
echo "File not found: packages/vue/src/dialog-box/src/pc.vue"
fi


</blockquote></details>

</blockquote></details>

</details>

<!-- This is an auto-generated comment by CodeRabbit for review status -->

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3611bfb and e982b6a.

📒 Files selected for processing (4)
  • examples/sites/src/App.vue (1 hunks)
  • packages/theme-saas/src/dialog-box/index.less (0 hunks)
  • packages/theme/src/dialog-box/index.less (1 hunks)
  • packages/vue/src/dialog-box/src/pc.vue (1 hunks)
💤 Files with no reviewable changes (1)
  • packages/theme-saas/src/dialog-box/index.less
🚧 Files skipped from review as they are similar to previous changes (2)
  • packages/vue/src/dialog-box/src/pc.vue
  • packages/theme/src/dialog-box/index.less
🔇 Additional comments (1)
examples/sites/src/App.vue (1)

63-82: Keyframe redefinitions: avoid long-term duplication; ensure build order makes this win.

Verification failed — ripgrep returned "No files were searched". Re-run detection with:
rg -nP --hidden --no-ignore '@Keyframes\s+dialog-fade-(in|out)' -C1
Confirm whether dialog-fade-in/out in examples/sites/src/App.vue (lines 63–82) are temporary overrides for @opentiny/next-remoter; if so add a TODO to remove once the dependency is updated and ensure this CSS is loaded after any conflicting definitions.

Comment on lines 53 to 62
<style lang="less">
// 由于 @opentiny/next-remoter/dist/style.css 中包含了旧版的弹窗和动画样式,这里额外处理一次
.v-modal {
background: transparent;
}

.tiny-dialog-box__wrapper.is-modal {
background: var(--tv-DialogBox-mask-bg-color);
}

Copy link

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

Scope the global .v-modal override to the docs shell to avoid collateral regressions.

Overriding .v-modal globally makes every overlay (dialogs, drawers, message boxes) transparent across the site. Limit the override to this app container and add a fallback for the mask color.

Apply within this hunk:

-.v-modal {
+.site-docs .v-modal {
   background: transparent;
 }
 
-.tiny-dialog-box__wrapper.is-modal {
-  background: var(--tv-DialogBox-mask-bg-color);
+.site-docs .tiny-dialog-box__wrapper.is-modal {
+  background: var(--tv-DialogBox-mask-bg-color, rgba(0, 0, 0, 0.45));
 }

And outside this hunk, add a namespacing class to the root container:

-  <div class="hp100 of-hidden">
+  <div class="hp100 of-hidden site-docs">

Verification script (checks for other overlays used in examples and presence of the mask var):


🏁 Script executed:

#!/bin/bash
# Find usages of overlays/components that rely on .v-modal in examples
rg -nP -C2 '(Tiny(Dialog|Modal|Drawer)|tiny-(dialog-box|modal)|v-modal|MessageBox|Confirm|Drawer)' examples/sites

# Ensure the mask color var is defined somewhere in themes
rg -nP --type=css --type=less --type=vue --glob '!**/node_modules/**' --color=never '\-\-tv-DialogBox-mask-bg-color'

Length of output: 270166


Scope .v-modal to the docs shell and add a fallback mask color.

Global .v-modal in examples/sites/src/App.vue (CSS hunk ≈ lines 53–61) affects many overlays; add the namespacing class to the root container and use a safe fallback for the mask var.

Apply this patch:

-.v-modal {
+.site-docs .v-modal {
   background: transparent;
 }
 
-.tiny-dialog-box__wrapper.is-modal {
-  background: var(--tv-DialogBox-mask-bg-color);
+.site-docs .tiny-dialog-box__wrapper.is-modal {
+  background: var(--tv-DialogBox-mask-bg-color, rgba(0, 0, 0, 0.45));
 }

And add the namespacing class to the root container:

-  <div class="hp100 of-hidden">
+  <div class="hp100 of-hidden site-docs">

File: examples/sites/src/App.vue — update the CSS hunk (≈53–61) and the root

.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<style lang="less">
// 由于 @opentiny/next-remoter/dist/style.css 中包含了旧版的弹窗和动画样式,这里额外处理一次
.v-modal {
background: transparent;
}
.tiny-dialog-box__wrapper.is-modal {
background: var(--tv-DialogBox-mask-bg-color);
}
<style lang="less">
// 由于 @opentiny/next-remoter/dist/style.css 中包含了旧版的弹窗和动画样式,这里额外处理一次
.site-docs .v-modal {
background: transparent;
}
.site-docs .tiny-dialog-box__wrapper.is-modal {
background: var(--tv-DialogBox-mask-bg-color, rgba(0, 0, 0, 0.45));
}
🤖 Prompt for AI Agents
In examples/sites/src/App.vue around lines 53–62, the global .v-modal selector
and the mask color usage are too broad and lack a fallback; update the CSS to
scope .v-modal under a namespacing class on the root (e.g., .docs-shell
.v-modal) and change the .tiny-dialog-box__wrapper.is-modal rule to use the CSS
variable with a safe fallback value (e.g., var(--tv-DialogBox-mask-bg-color,
rgba(...))). Then add that same namespacing class to the root <div> in the
template so the styles only apply inside the docs shell.

@gausszhou gausszhou changed the title [WIP]fix(dialog-box): fix dialog wrapper animation is not working fix(dialog-box): fix dialog wrapper animation is not working Sep 13, 2025
@github-actions github-actions bot added the bug Something isn't working label Sep 13, 2025
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (2)
examples/sites/src/main.js (2)

5-6: Keep the CSS reset first; load legacy CSS immediately after it.

Resets should be imported before any library CSS to avoid unintended overrides. Swap these two imports.

-import '@opentiny/next-remoter/dist/style.css'
-import '@unocss/reset/eric-meyer.css'
+import '@unocss/reset/eric-meyer.css'
+import '@opentiny/next-remoter/dist/style.css'

4-4: Clarify and internationalize the comment.

Avoid “不确定…请评估” in committed code; make the rationale explicit and add English for OSS readers.

-// 由于 @opentiny/next-remoter/dist/style.css 中包含了旧版的弹窗和动画样式,这里调整到最前,不确定是否会有其他影响,请评估
+// 为兼容示例页中的旧版弹窗/动画样式,需引入 next-remoter 的旧样式,并将其尽量靠前(在 reset 之后)以降低覆盖面。
+// Load legacy dialog/modal styles for demo compatibility; import early (right after the CSS reset) to minimize overrides. See issue #3636.
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e982b6a and 820049f.

📒 Files selected for processing (5)
  • examples/sites/src/App.vue (0 hunks)
  • examples/sites/src/main.js (1 hunks)
  • packages/theme-saas/src/dialog-box/index.less (0 hunks)
  • packages/theme/src/dialog-box/index.less (1 hunks)
  • packages/vue/src/dialog-box/src/pc.vue (1 hunks)
💤 Files with no reviewable changes (2)
  • packages/theme-saas/src/dialog-box/index.less
  • examples/sites/src/App.vue
🚧 Files skipped from review as they are similar to previous changes (2)
  • packages/vue/src/dialog-box/src/pc.vue
  • packages/theme/src/dialog-box/index.less
🔇 Additional comments (1)
examples/sites/src/main.js (1)

4-5: Verify legacy .v-modal styles aren't reintroduced by @opentiny/next-remoter import

Found .v-modal and dialog-fade keyframes in:

  • packages/theme/src/dialog-box/index.less
  • packages/theme-saas/src/dialog-box/index.less

node_modules/@opentiny/next-remoter was not present locally, so its dist/style.css wasn't inspected.

  • Runtime check: open a dialog and inspect computed styles — confirm .v-modal does NOT render a backdrop/animations and that .tiny-dialog-box__wrapper.is-modal is the only mask.
  • If legacy rules still apply, add a docs-only override loaded last. Example (examples/sites/src/assets/overrides/reset-legacy-modal.css):
/* Neutralize legacy overlay/animations from next-remoter for docs site */
.v-modal { background: transparent !important; box-shadow: none !important; }
.v-modal, .v-modal-enter-active, .v-modal-leave-active { animation: none !important; transition: none !important; }

Import it after other CSS in main.js:

import './assets/overrides/reset-legacy-modal.css'

@@ -1,5 +1,8 @@
import { createHead } from '@vueuse/head'
import { createApp } from 'vue'

// 由于 @opentiny/next-remoter/dist/style.css 中包含了旧版的弹窗和动画样式,这里调整到最前,不确定是否会有其他影响,请评估
import '@opentiny/next-remoter/dist/style.css'
Copy link

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

Confirm dependency presence and single import.

Ensure @opentiny/next-remoter is declared (root/examples package.json) and not imported elsewhere (e.g., App.vue), to avoid dup loads and 404s in CI.


🏁 Script executed:

#!/bin/bash
# Confirm a single import site
rg -nP "@opentiny/next-remoter/dist/style\\.css"

# Verify dependency is declared (adjust path if examples has its own package.json)
if command -v jq >/dev/null; then
  fd -t f package.json -d 2 | xargs -I{} sh -c 'echo "{}:"; jq -r ".dependencies[\"@opentiny/next-remoter\"], .devDependencies[\"@opentiny/next-remoter\"]" "{}"'
else
  rg -nP '"@opentiny/next-remoter"\s*:' --glob package.json
fi

Length of output: 211


Declare @opentiny/next-remoter in package.json or remove the import

  • Single import found: examples/sites/src/main.js:5 — import '@opentiny/next-remoter/dist/style.css'.
  • Root package.json does not declare @opentiny/next-remoter (jq returned null). Add the dependency to the appropriate package.json (examples/sites/package.json or repo root) or remove the import to avoid CI 404s and duplicate loads.
🤖 Prompt for AI Agents
In examples/sites/src/main.js at line 5, the file imports
'@opentiny/next-remoter/dist/style.css' but that package is not declared in
package.json; either add @opentiny/next-remoter (appropriate version) to
examples/sites/package.json or the repo root package.json so the dependency is
installed, then run install to update lockfile, or remove the import from
examples/sites/src/main.js if the stylesheet is not needed; ensure package.json
dependency is added to the correct package (examples/sites) to avoid CI 404s and
duplicate loads.

@gausszhou gausszhou changed the title fix(dialog-box): fix dialog wrapper animation is not working [WIP]fix(dialog-box): fix dialog wrapper animation is not working Sep 13, 2025
@github-actions github-actions bot removed the bug Something isn't working label Sep 13, 2025
@gausszhou gausszhou closed this Sep 13, 2025
@gausszhou gausszhou reopened this Sep 13, 2025
@gausszhou gausszhou changed the title [WIP]fix(dialog-box): fix dialog wrapper animation is not working fix(vue-popup): fix v-modal animation is not working Sep 13, 2025
@github-actions github-actions bot added the bug Something isn't working label Sep 13, 2025
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/vue-hooks/src/vue-popup.ts (1)

159-176: closeDelay bug: reading from vm.closeDelay ignores prop; delays won’t apply.

openDelay reads from props.openDelay, but closeDelay reads from vm.closeDelay, likely undefined, causing immediate close. Align with props.closeDelay.

Apply this diff:

-    const closeDelay = Number(vm.closeDelay)
+    const props: any = (vm as any).$props || vm
+    const closeDelay = Number(props.closeDelay)
🧹 Nitpick comments (1)
packages/vue-hooks/src/vue-popup.ts (1)

114-120: Prefer props.modalFade when present; fall back to !props.noAnimation

In packages/vue-hooks/src/vue-popup.ts pass (props.modalFade ?? !props.noAnimation) to PopupManager.openModal to preserve backward compatibility.

         PopupManager.openModal(
           vm._popupId,
           PopupManager.nextZIndex(),
           props.modalAppendToBody ? undefined : dom,
           props.modalClass,
-          !props.noAnimation
+          (props.modalFade ?? !props.noAnimation)
         )
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4bc7a09 and 8b4b78d.

📒 Files selected for processing (1)
  • packages/vue-hooks/src/vue-popup.ts (1 hunks)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant