Skip to content

♿️(frontend) enable blocknote heading ids for toc anchors#2449

Merged
Ovgodd merged 1 commit into
mainfrom
fix/a11y-2345-toc-heading-ids
Jun 23, 2026
Merged

♿️(frontend) enable blocknote heading ids for toc anchors#2449
Ovgodd merged 1 commit into
mainfrom
fix/a11y-2345-toc-heading-ids

Conversation

@Ovgodd

@Ovgodd Ovgodd commented Jun 22, 2026

Copy link
Copy Markdown
Collaborator

Purpose

Follow-up to #2390: complete table of contents anchor navigation by linking TOC entries to native BlockNote block ids.

replaced TOC <button> entries with <a> links, but href="#heading-{blockId}" had no matching target in the DOM. BlockNote suggested using setIdAttribute: true instead of manual DOM manipulation.

Proposal

  • Enable setIdAttribute: true on BlockNote editor and reader
  • Update TOC links to href="#{blockId}" (native block id)
  • Scroll to headings via getElementById(blockId) instead of [data-id]
  • Update doc-table-content e2e tests for new href format

@Ovgodd Ovgodd requested a review from AntoLC June 22, 2026 08:30
@Ovgodd Ovgodd self-assigned this Jun 22, 2026
@Ovgodd Ovgodd force-pushed the fix/a11y-2345-toc-heading-ids branch from 31750f0 to 5a926bb Compare June 22, 2026 08:32
@Ovgodd Ovgodd marked this pull request as ready for review June 22, 2026 08:32
@Ovgodd Ovgodd moved this from Backlog to In review in LaSuite Docs A11y Jun 22, 2026
@github-actions

github-actions Bot commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Size Change: +1 B (0%)

Total Size: 4.34 MB

📦 View Changed
Filename Size Change
apps/impress/out/_next/static/a3aacfdd/_buildManifest.js 0 B -675 B (removed) 🏆
apps/impress/out/_next/static/c3efdbab/_buildManifest.js 676 B +676 B (new file) 🆕

compressed-size-action

@coderabbitai

coderabbitai Bot commented Jun 22, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: d23f3744-4ab8-4b28-ada5-3c246b387057

📥 Commits

Reviewing files that changed from the base of the PR and between 5a926bb and 09f9568.

📒 Files selected for processing (4)
  • CHANGELOG.md
  • src/frontend/apps/e2e/__tests__/app-impress/doc-table-content.spec.ts
  • src/frontend/apps/impress/src/features/docs/doc-editor/components/BlockNoteEditor.tsx
  • src/frontend/apps/impress/src/features/docs/doc-table-content/components/Heading.tsx

Walkthrough

The PR enables BlockNote's native heading ID attribute by passing setIdAttribute: true to useCreateBlockNote in both BlockNoteEditor and BlockNoteReader. The TOC Heading component is updated to use the resulting element IDs directly: the anchor href changes from #heading-${headingId} to #${headingId}, and the click-handler scroll target switches from a querySelector on data-id to document.getElementById(headingId). The e2e test assertions are relaxed to accept any fragment-style href (^#.+), and a changelog entry is added.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested reviewers

  • AntoLC
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: enabling BlockNote heading IDs for TOC anchors, which directly corresponds to the primary objective of the pull request.
Description check ✅ Passed The description is directly related to the changeset, providing context about the follow-up work, explaining the problem, and listing specific implementation steps that align with the actual code changes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/a11y-2345-toc-heading-ids

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/frontend/apps/e2e/__tests__/app-impress/doc-table-content.spec.ts`:
- Around line 44-48: The current assertions for link1, link2, and link3 only
verify that their href attributes follow the fragment format pattern /^#.+/, but
do not validate that these fragments actually resolve to existing elements on
the page. Modify the test to extract the actual href value from each link
element and then verify that an element with the corresponding ID exists on the
page using the page locator, ensuring the anchor targets are real and functional
end-to-end.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: b3ac5839-1fba-48ef-96b2-816858c1bcac

📥 Commits

Reviewing files that changed from the base of the PR and between 87fbcba and 5a926bb.

📒 Files selected for processing (4)
  • CHANGELOG.md
  • src/frontend/apps/e2e/__tests__/app-impress/doc-table-content.spec.ts
  • src/frontend/apps/impress/src/features/docs/doc-editor/components/BlockNoteEditor.tsx
  • src/frontend/apps/impress/src/features/docs/doc-table-content/components/Heading.tsx

cellTextColor: true,
headers: true,
},
setIdAttribute: true,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💪

Use setIdAttribute and link TOC entries to native block ids.
@Ovgodd Ovgodd force-pushed the fix/a11y-2345-toc-heading-ids branch from 5a926bb to 09f9568 Compare June 23, 2026 09:46
@Ovgodd Ovgodd merged commit 09f9568 into main Jun 23, 2026
42 checks passed
@Ovgodd Ovgodd deleted the fix/a11y-2345-toc-heading-ids branch June 23, 2026 10:13
@github-project-automation github-project-automation Bot moved this from In review to Done in LaSuite Docs A11y Jun 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants