reactjs / reactjs/react.dev

[Bug]: URI Text Fragments do not work with "Deep Dive" text blocks

未关闭
#7,686 1 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

bug: unconfirmed
主要语言
JavaScript
星标
11.8k
派生
7.9k
平均合并
1 天 11 小时
30 天内合并 PR
11

描述

Summary

Clicking a doc link that includes a Text Fragment does not scroll nor highlight the relevant text, if that text happens to be inside a "Deep Dive" section.

Page

https://react.dev/reference/react/useCallback#:~:text=Caching%20a%20function%20with,in%20other%20cases

Details

When attempting to quote a part of the doc that is under a "Deep Dive" section, with a URI text fragment: clicking the link will open the documentation page in the browser, but without scrolling to the relevant block nor highlighting the quoted part of the documentation.

However, there are two cases the highlighting works. Both of those require the page to already be loaded, the fragment is added to the uri of the page:

  • If the section is not opened beforehand: the browser still does not scrolls to the section nor open it, but the text is correctly highlighted.
  • If the section is opened beforehand: the browser scrolls to the section and highlights the text as expected

Here's a video capture of the problem:

https://github.com/user-attachments/assets/989e0a8c-2729-4072-aeca-ded2ac7d5c72

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

从链接的 react.dev/reference/react/useCallback 页面开始,检查初始导航期间 "Deep Dive" 部分的渲染和打开方式。在新页面加载时重现提供的文本片段 URL,然后将其与加载并打开该部分后再添加片段的情况进行比较。当浏览器在直接导航时滚动到折叠的 "Deep Dive" 部分中的文本并将其高亮显示时,即表示完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
javascript, react
领域
documentation, web-dev
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
48/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。