Skip to content

[Bug] 文件树右键菜单「在应用中打开」二级子菜单超出屏幕右缘无法点击(靠右缘时子菜单溢出视口) #490

Description

@eg-bole

提交前确认 / Pre-submit checklist

  • 我已搜索现有 issue,确认没有完全相同的条目(只有完全一致才算重复)| I searched existing issues and confirmed there is no exact duplicate (only exactly identical issues count as duplicates)
  • 我已确认使用最新版本 dsh-better-sidebar / I confirmed I am on the latest dsh-better-sidebar version

运行环境 / Environment:DSH Web(浏览器访问)/ DSH Web (browser access)

DSH Web 版本 + 浏览器 / DSH Web version + Browser:DSH 0.1.1-rc.2 + Chrome 151.0.7922.174

插件版本 / Plugin version:v0.17.1

类别 / Category:🐛 Bug(功能异常 / Something is broken)

描述 / Description

现象:在 Files 文件窗口(文件树)中对文件右键,弹出上下文菜单;当菜单出现在屏幕右缘附近时(Files 面板位于窗口右侧,右键树中靠右的行尤其容易触发),把鼠标移到「在应用中打开 >」一行,弹出的二级子菜单整体超出视口右缘——子菜单始终从主菜单的右侧展开,条目(资源管理器 / VS Code / Cursor / Zed / 自定义编辑器)落在屏幕外,无法悬停、无法点击。主菜单本身会被正确钳制在视口内(距右缘 12px),只有二级菜单溢出。

期望行为:二级子菜单应做视口感知:贴近右缘时向左翻转展开(或整体钳制在视口内),保证条目可见可点。

复现步骤

  1. DSH Web + dsh-better-sidebar v0.17.1
  2. 打开 Files 文件窗口(文件树),窗口位于屏幕右侧
  3. 对文件树中某一行的文件右键(行内容越靠右越容易复现)
  4. 鼠标移到「在应用中打开 >」项(或点击该项)
  5. 二级子菜单从主菜单右侧展开,超出屏幕右缘,条目不可见 / 不可点击

截图或日志
Image

补充信息 / Additional context

  • 根因定位:问题出在 DSH 的 Menu 原语(@deepseek-ai/dsh-client-ui-primitives)——子菜单不支持视口感知的翻转/钳制,better-sidebar 只是消费者:
    • 子菜单 CSS 固定向右展开:Menu.module.css.submenu { position: absolute; bottom: -4px; left: calc(100% + 10px); min-width: 163px; z-index: 101; }
    • portal 定位只钳制主菜单、不计子菜单宽度、无翻转逻辑:Menu.tsxplace()x = Math.min(Math.max(x, MARGIN), vw - lw - MARGIN)lw 为主列表宽度)
    • 使用方:src/client/FileTree.tsxopenWithEntries() 生成「在应用中打开 >」子菜单行,经 <Menu portal getAnchorRect={右键坐标}> 渲染到 document.bodyposition: fixed,不会被祖先裁剪,但超出视口即无法点击)
  • 相关但不重复

English TL;DR

The "Open with >" submenu in the file-tree right-click menu always opens to the right of its parent row. When the context menu sits near the viewport's right edge (the Files panel is on the right side of the window), the submenu extends off-screen and its items cannot be hovered or clicked. Root cause is in the DSH Menu primitive (dsh-client-ui-primitives): no viewport-aware submenu flip/clamp (.submenu { left: calc(100% + 10px) }, and the portal place() clamps only the main list). Related but distinct: #412 (open-with no reaction), #334 (the feature PR).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3低:体验/建议area/explorerFile tree / explorer: navigation, context menu, searchbugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions