storybookjs/storybook

[Bug]: 7.1 Table of Contents active heading highlight broken

已关闭

#23,584 创建于 2023年7月25日

 (7 条评论) (0 个反应) (0 位负责人)TypeScript (10,058 个派生)batch import
addon: docsbuggood first issuehelp wantedsev:S4

仓库指标

星标
 (89,909 个星标)
PR 合并指标
 (平均合并 7天 22小时) (30 天内合并 184 个 PR)

描述

Describe the bug

When there are subheadings (H3) with the same name under different headings (H2), the highlighting becomes broken, and only subheadings from the first H2 group get highlighted in the TOC as you scroll through the page.

To Reproduce

  1. Create a documentation page of a similar format:
## Button

### Properties

Lorem ipsum

### Slots

Lorem ipsum

### Events

Lorem ipsum

## Input

### Properties

Lorem ipsum

### Slots

Lorem ipsum

### Events

Lorem ipsum

## Tooltip

### Properties

Lorem ipsum

### Slots

Lorem ipsum

### Events

Lorem ipsum
  1. Add to a Storybook instance and enable TOC
  2. Observe TOC links becoming active, only links from the first group "Button" will be highlighted as you scroll past "Input" and "Tooltip"

System

System:
    OS: macOS 13.4.1
    CPU: (8) x64 Intel(R) Core(TM) i7-1068NG7 CPU @ 2.30GHz
  Binaries:
    Node: 16.18.1 - ~/Library/Caches/fnm_multishells/66230_1690247671085/bin/node
    npm: 9.7.1 - ~/Library/Caches/fnm_multishells/66230_1690247671085/bin/npm
  Browsers:
    Chrome: 115.0.5790.102
    Edge: 114.0.1823.67
    Safari: 16.5.2
  npmPackages:
    @storybook/addon-a11y: ^7.1.0 => 7.1.0 
    @storybook/addon-essentials: ^7.1.0 => 7.1.0 
    @storybook/addon-links: ^7.1.0 => 7.1.0 
    @storybook/addons: ^7.1.0 => 7.1.0
    @storybook/theming: ^7.1.0 => 7.1.0 
    @storybook/web-components: ^7.1.0 => 7.1.0 
    @storybook/web-components-webpack5: ^7.1.0 => 7.1.0

Additional context

No response

贡献者指南