`Tooltip` is incompatible with callback refs
维护者通常 2 天内回复
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 70/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 活跃
- 技术栈
- react, typescript
- 领域
- frontend
调研方向
Start at the Tooltip component's ref handling and reproduce the callback-ref example from the issue, comparing it with the object-ref case. Done means a callback ref passed to Tooltip still receives the underlying element and the tooltip appears when hovering the wrapped Button.
由索引模型根据 Issue 内容生成。
描述
Description
When I encountered https://github.com/primer/react/issues/8373 I moved my callback ref to the wrapping Tooltip . This appeared to forward the ref to the underlying element as I wanted. However, if the passed ref is a callback ref, the tooltip never appears. This is not the case for an object ref.
Steps to reproduce
This breaks, even though it typechecks just fine. The log does get called, but the tooltip does not appear:
const logRef = useCallback(element => console.log(element), [])
return <Tooltip ref={logRef} text="Example"><Button>Button text</Button></Tooltip>
This works, but isn't a callback ref:
const logRef = useRef(null)
return <Tooltip ref={logRef} text="Example"><Button>Button text</Button></Tooltip>
And this shows the tooltip but never calls the log (#8373):
const logRef = useCallback(element => console.log(element), [])
return <Tooltip text="Example"><Button ref={logRef}>Button text</Button></Tooltip>
Version
v38.37.0
Browser
No response
- 主要语言
- TypeScript
- 星标
- 3.9k
- 派生
- 697
- 平均合并
- 3 天 12 小时
- 30 天内合并 PR
- 51
环境准备
在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 没有贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
primer/react 的其他 Issue
-
PageHeader.Title does not seem to accept id prop可能已有人在做 @TylerJDev 于 3 天前认领。 未关闭component: PageHeader react staff
难度 2/5 1-3 小时 新手友好度 72/100
primer/react#8474 · 1 条评论 · 1 个 reaction · 已指派 1 人 ·
维护者通常 2 天内回复
-
The padding prop seems to have no effect with PageLayout.Sidebar可能已有人在做 @minwookshin 于 15 天前认领。 未关闭component: PageLayout react staff
难度 2/5 1-3 小时 新手友好度 68/100
primer/react#8470 · 1 条评论 · 1 个 reaction ·
维护者通常 2 天内回复
-
bug component: Spinner react
难度 2/5 1-3 小时 新手友好度 74/100
维护者通常 2 天内回复
-
waiting for author response
难度 2/5 1-3 小时 新手友好度 74/100
维护者通常 2 天内回复
-
Checkbox: replace useLayoutEffect with ref callback for indeterminate prop可能重新可做 关联的 PR 已关闭且未合并。 未关闭component: Checkbox react
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 2 天内回复
相似的 Issue
-
documentation good first issue
难度 2/5 半天 新手友好度 72/100
sujithputta02/Esapay#13 ·
-
Share dialog: the address book's contact count reads "1 contacts" (no singular form in any language)可能已有人在做 @chibenwa 今天认领。 未关闭ai-driven-qa bug claude Cosmetic
难度 2/5 1-3 小时 新手友好度 72/100
linagora/twake-contacts-frontend#271 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
Koenkk/zigbee2mqtt#33402 ·
维护者通常 1 天内回复
-
dx P2 platform Stellar Wave Wave 10
难度 2/5 1-3 小时 新手友好度 72/100
winsznx/routedock#579 · 1 条评论 ·
维护者通常 1 天内回复
-
area:ui effort:S enhancement priority:P2
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复