AppScreen's height calculated as 0 when used with Radix UI Dropdown Menu
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 45/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- css, react, typescript
- 领域
- frontend
调研方向
从 StackBlitz 复现开始,找到设置 position 和 height 的 AppScreen 样式。打开 Radix UI 的 Dropdown Menu 来复现该问题,然后验证当菜单更改 document.body 的样式时,AppScreen 仍然可见并保持预期的 viewport 高度。
由索引模型根据 Issue 内容生成。
描述
Description
When using Radix UI's Dropdown Menu inside the AppScreen component of stackflow, the AppScreen component's height is calculated as 0, causing it to become invisible.
Issue Reproduction
https://stackblitz.com/edit/stackflow-with-radix-ui-dropdown?file=src%2FMyAcitivity.tsx
Possible Causes
This issue seems to be related to the react-remove-scroll-bar library used internally by the Radix UI Dropdown Menu. When the dropdown opens, it adds position: relative to the document.body.
body[${lockAttribute}] {
...
${[
allowRelative && `position: relative ${important};`,
...
]
.filter(Boolean)
.join('')}
}
Since the AppScreen component has position: absolute and height: 100% styles, its height is calculated relative to the body (now position: relative), resulting in height of 0.
Suggested Solution
If the reason for using height: 100% is to set the height relative to the Initial Containing Block (ViewPort), assuming there's no positioned ancestor for AppScreen component, then replacing height: 100% with height: 100vh might solve the problem.
If dynamic changes to vh (due to address bars on mobile browsers) are a concern, using newer CSS units like lvh, svh, or dvh could be a suitable alternative. (https://stackoverflow.com/a/72245072/4773272)
- 主要语言
- TypeScript
- 星标
- 1k
- 派生
- 113
- 平均合并
- 1 小时 45 分钟
- 30 天内合并 PR
- 6
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
daangn/stackflow 的其他 Issue
-
스와이프 백 애니메이션 덜컥임 이슈可能重新可做 @Shennng 于 224 天前认领,目前没有进行中的 PR。 未关闭
难度 4/5 3-5 天 新手友好度 45/100
daangn/stackflow#672 · 1 条评论 · 1 个 reaction ·
维护者通常 1 天内回复
-
Vue3 지원 계획未关闭
难度 5/5 一周以上 新手友好度 25/100
daangn/stackflow#669 · 2 条评论 · 2 个 reaction ·
维护者通常 1 天内回复
-
难度 5/5 一周以上 新手友好度 25/100
维护者通常 1 天内回复
-
难度 5/5 一周以上 新手友好度 18/100
维护者通常 1 天内回复
-
难度 5/5 一周以上 新手友好度 30/100
维护者通常 1 天内回复
相似的 Issue
-
难度 1/5 1 小时以内 新手友好度 65/100
521xueweihan/HelloGitHub#4025 ·
-
难度 2/5 1-3 小时 新手友好度 82/100
voidzero-dev/void#478 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 69/100
Small-tailqwq/dsh-deep-whale#207 ·
维护者通常 1 天内回复
-
The inspector never shows the instances field, so scaling out is unreachable可能已有人在做 @Mrkewl 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 76/100
xevrion/breakscale#96 ·
维护者通常 4 天内回复
-
难度 2/5 1-3 小时 新手友好度 70/100
Flux159/mcp-server-kubernetes#384 ·