Skip to content

fix: delete Popconfirm being obscured by fixed columns #6118

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

Merged
merged 3 commits into from
May 6, 2025

Conversation

LooseLi
Copy link
Contributor

@LooseLi LooseLi commented May 6, 2025

Description

Fixes #6114

在角色管理页面中,当用户点击删除按钮时,删除确认框(Popconfirm)会被表格右侧的固定列遮挡,导致用户无法正常操作确认框。这个问题在平板和移动设备上尤为明显,因为屏幕宽度有限,表格的操作列会通过绝对定位固定在右侧。

通过代码分析,发现问题的根本原因是:

  1. 表格操作列通过 fixed: 'right' 属性设置为固定在右侧,这是通过绝对定位实现的
  2. 删除确认框(Popconfirm)被定位在表格内部的 tbody 元素中
  3. 当表格宽度不够时,固定列会覆盖在表格内部元素上面,包括删除确认框

解决方案
修改了 vxe-table.ts 文件中的 renderConfirm 函数,将 Popconfirm 组件的定位容器从表格内部的 tbody 元素改为 document.body。这样修改后,删除确认框不再受表格内部层叠上下文的限制,因此不会被固定列遮挡。
image

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update
  • Please, don't make changes to pnpm-lock.yaml unless you introduce a new test example.

Checklist

ℹ️ Check all checkboxes - this will indicate that you have done everything in accordance with the rules in CONTRIBUTING.

  • If you introduce new functionality, document it. You can run documentation with pnpm run docs:dev command.
  • Run the tests with pnpm test.
  • Changes in changelog are generated from PR name. Please, make sure that it explains your changes in an understandable manner. Please, prefix changeset messages with feat:, fix:, perf:, docs:, or chore:.
  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

Summary by CodeRabbit

  • Bug Fixes
    • Improved the display of confirmation popups in tables to prevent them from being hidden behind fixed columns.
    • Enhanced popup behavior to prevent table scrolling while confirmation popups are open.

Copy link

changeset-bot bot commented May 6, 2025

⚠️ No Changeset found

Latest commit: f78d24a

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link
Contributor

coderabbitai bot commented May 6, 2025

## Walkthrough

The change updates the `getPopupContainer` method in the VXE table's `CellOperation` renderer to always return `document.body` as the popup container for the `Popconfirm` component. This adjustment addresses issues where the popup could be obscured by fixed columns. Additionally, pointer events on the `.vxe-table--viewport-wrapper` element are disabled while the popup is open to prevent scrolling and ensure the popup remains visible. No other logic or exported entity signatures were modified.

## Changes

| File(s)                                    | Change Summary                                                                                                   |
|--------------------------------------------|-----------------------------------------------------------------------------------------------------------------|
| playground/src/adapter/vxe-table.ts        | Refactored `getPopupContainer` in `CellOperation` renderer to always return `document.body`; disabled pointer events on `.vxe-table--viewport-wrapper` while popconfirm is open to prevent scrolling and popup clipping. |

## Sequence Diagram(s)

```mermaid
sequenceDiagram
    participant User
    participant Table
    participant Popconfirm
    participant ViewportWrapper

    User->>Table: Trigger CellOperation (e.g., delete)
    Table->>Popconfirm: Render with getPopupContainer returning document.body
    Popconfirm->>document.body: Attach popup to body
    Popconfirm->>ViewportWrapper: Disable pointer-events on open
    User->>ViewportWrapper: Attempt to scroll (blocked)
    Popconfirm->>ViewportWrapper: Enable pointer-events on close

Assessment against linked issues

Objective Addressed Explanation
Prevent Popconfirm popup from being obscured by fixed columns in Role Management table (#6114)

Suggested reviewers

  • anncwb
  • jinmao88

Poem

A popup once hid, now floats so free,
No columns to block what you wish to see.
With document.body, it finds its new place,
Pointer events paused, no scroll to chase.
🐇✨

Clear views bloom in the VXE space!


<!-- walkthrough_end -->


---

<details>
<summary>📜 Recent review details</summary>

**Configuration used: CodeRabbit UI**
**Review profile: CHILL**
**Plan: Pro**

<details>
<summary>📥 Commits</summary>

Reviewing files that changed from the base of the PR and between d3b926d093ab69f3ead232d178b2e574788ccc3f and f78d24a5c5d1d05827f0a1bd0eb3e726e4e39113.

</details>

<details>
<summary>📒 Files selected for processing (1)</summary>

* `playground/src/adapter/vxe-table.ts` (1 hunks)

</details>

<details>
<summary>🚧 Files skipped from review as they are similar to previous changes (1)</summary>

* playground/src/adapter/vxe-table.ts

</details>

<details>
<summary>⏰ Context from checks skipped due to timeout of 90000ms (2)</summary>

* GitHub Check: post-update (windows-latest)
* GitHub Check: post-update (ubuntu-latest)

</details>

</details>
<!-- internal state start -->


<!-- DwQgtGAEAqAWCWBnSTIEMB26CuAXA9mAOYCmGJATmriQCaQDG+Ats2bgFyQAOFk+AIwBWJBrngA3EsgEBPRvlqU0AgfFwA6NPEgQAfACgjoCEYDEZyAAUASpETZWaCrKNxU3bABsvkCiQBHbGlcSHFcLzpIACIAM3gADy4lSJprfG4mDHiKZkgBEngMIn4BRAZsf3o5SHiEqKYvRwxEaPRaWn9ERGkUbuDIMwA2AEYRgBYULFxYEkgJYLAJAowwNFpmIp4KfBExDRhZ7cFIvPwGCopkfGmjncjIZkw0UjYMUO4XuYB3Wf8wo4pEhpLI5J7iG6QWjwNBefAlAAUVgyoPguQAlH1SuVKlEajM5rgVJEAOTIOpRCjwIiwUKNZqIAA0kGk3FEMJ88khRIEqWQmHozEE8AeSgk8AYvW+6lgkC88E2NHo5X8ZEg0toMwOcDmFPo9OYLXQ/wV3FO7Ci2EQRRKKkQ+CaaW4+GtEIwNuZDDQVptAJIeQI/CkFC8aHkBPSmRuYIUzGd5HezN+EtlqH8GCUVSm1qUfrCxJIZLCAkU8hI5veGjcd3w+Dp3p6KCU73g8SiqBm1DzyKj2TReVQWUQuCoRSi0pmWwjPNJyCKNAoGFhkA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2cNMm41xXozUk1ESunheRqvYCfflBgoClTVq1XyRk1qpZ6Rlr99hY7VS6KrbLzjct8Hy/KBgLIWziClJQOYTwlBVnpdEIwKKvm9f2YcvAhBAVnIaKC94XAqCQo5s4eQNQQNUARa85FHyDBTYoeoAA+rTRAp2HWoboKd98zj3mGCOzsqEABmAQABOAATEMWgAAGD7r2VBDA+7EV7m8vuva+7QEYAB2AAHAIL7JAACssPxgI/hxcBgr3XpbKm7EBHtAvvjDQCjhgKOYf/ZR/Dr7sPYh/bQCMAQ/2SACHB7Dn7JBxgkFex9sYr3HuoqgCd3A53aCXeuy027ezHtAA=== -->

<!-- internal state end -->
<!-- finishing_touch_checkbox_start -->

<details open="true">
<summary>✨ Finishing Touches</summary>

- [ ] <!-- {"checkboxId": "7962f53c-55bc-4827-bfbf-6a18da830691"} --> 📝 Generate Docstrings

</details>

<!-- finishing_touch_checkbox_end -->
<!-- tips_start -->

---

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.

<details>
<summary>❤️ Share</summary>

- [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai)
- [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai)
- [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai)
- [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)

</details>

<details>
<summary>🪧 Tips</summary>

### Chat

There are 3 ways to chat with [CodeRabbit](https://coderabbit.ai?utm_source=oss&utm_medium=github&utm_campaign=vbenjs/vue-vben-admin&utm_content=6118):

- Review comments: Directly reply to a review comment made by CodeRabbit. Example:
  - `I pushed a fix in commit <commit_id>, please review it.`
  - `Generate unit testing code for this file.`
  - `Open a follow-up GitHub issue for this discussion.`
- Files and specific lines of code (under the "Files changed" tab): Tag `@coderabbitai` in a new review comment at the desired location with your query. Examples:
  - `@coderabbitai generate unit testing code for this file.`
  -	`@coderabbitai modularize this function.`
- PR comments: Tag `@coderabbitai` in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
  - `@coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.`
  - `@coderabbitai read src/utils.ts and generate unit testing code.`
  - `@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.`
  - `@coderabbitai help me debug CodeRabbit configuration file.`

### Support

Need help? Create a ticket on our [support page](https://www.coderabbit.ai/contact-us/support) for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

### CodeRabbit Commands (Invoked using PR comments)

- `@coderabbitai pause` to pause the reviews on a PR.
- `@coderabbitai resume` to resume the paused reviews.
- `@coderabbitai review` to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
- `@coderabbitai full review` to do a full review from scratch and review all the files again.
- `@coderabbitai summary` to regenerate the summary of the PR.
- `@coderabbitai generate docstrings` to [generate docstrings](https://docs.coderabbit.ai/finishing-touches/docstrings) for this PR.
- `@coderabbitai generate sequence diagram` to generate a sequence diagram of the changes in this PR.
- `@coderabbitai resolve` resolve all the CodeRabbit review comments.
- `@coderabbitai configuration` to show the current CodeRabbit configuration for the repository.
- `@coderabbitai help` to get help.

### Other keywords and placeholders

- Add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed.
- Add `@coderabbitai summary` to generate the high-level summary at a specific location in the PR description.
- Add `@coderabbitai` anywhere in the PR title to generate the title automatically.

### CodeRabbit Configuration File (`.coderabbit.yaml`)

- You can programmatically configure CodeRabbit by adding a `.coderabbit.yaml` file to the root of your repository.
- Please see the [configuration documentation](https://docs.coderabbit.ai/guides/configure-coderabbit) for more information.
- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: `# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json`

### Documentation and Community

- Visit our [Documentation](https://docs.coderabbit.ai) for detailed information on how to use CodeRabbit.
- Join our [Discord Community](http://discord.gg/coderabbit) to get help, request features, and share feedback.
- Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.

</details>

<!-- tips_end -->

@imdap
Copy link
Contributor

imdap commented May 6, 2025

在antd这样会造成滚动不跟随 且antd默认就是挂载在body
image

image

Copy link
Collaborator

@mynetfan mynetfan left a comment

Choose a reason for hiding this comment

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

这个getPopupContainer默认就是body,在表格中使用会导致弹出层不会跟随表格的滚动

@mynetfan mynetfan merged commit 5949c73 into vbenjs:main May 6, 2025
5 checks passed
@LooseLi
Copy link
Contributor Author

LooseLi commented May 7, 2025

你们说得对,我确实没有考虑到弹窗跟随表格滚动的情况。现在看起来问题比预期的要复杂。

@LooseLi
Copy link
Contributor Author

LooseLi commented May 7, 2025

这个getPopupContainer默认就是body,在表格中使用会导致弹出层不会跟随表格的滚动

我暂时也没找到既能解决遮挡又能让弹窗跟随表格滚动的兼容方案,目前这个确实是个不错的折中思路,学习了!

mynetfan added a commit that referenced this pull request May 19, 2025
* fix: delete Popconfirm being obscured by fixed columns

* fix: opened popConfirm will prevent the table from scrolling

---------

Co-authored-by: Netfan <[email protected]>
baohaojie123 added a commit to baohaojie123/vue-vben-admin that referenced this pull request Jun 4, 2025
* 'main' of https://github.com/baohaojie123/vue-vben-admin:
  fix: missing argument for getPopupContainer
  fix: delete Popconfirm being obscured by fixed columns (vbenjs#6118)
  chore: release v5.5.6
  fix: handle undefined children in generate-menus (vbenjs#6117)
  fix: when keepAlive is enabled, returning directly through browser buttons/gestures will not close pop ups (vbenjs#6113)

# Conflicts:
#	apps/web-antd/package.json
#	apps/web-naive/package.json
baohaojie123 added a commit to baohaojie123/vue-vben-admin that referenced this pull request Jun 4, 2025
* 'main' of https://github.com/baohaojie123/vue-vben-admin:
  fix: missing argument for getPopupContainer
  fix: delete Popconfirm being obscured by fixed columns (vbenjs#6118)
  chore: release v5.5.6
  fix: handle undefined children in generate-menus (vbenjs#6117)
  fix: when keepAlive is enabled, returning directly through browser buttons/gestures will not close pop ups (vbenjs#6113)
@github-actions github-actions bot locked and limited conversation to collaborators Jun 7, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug: 系统管理-角色管理删除数据时删除弹出框被右侧固定列遮挡
3 participants