Skip to content

feat: additional heading top padding (BLO-1008)#2690

Merged
nperez0111 merged 1 commit intomainfrom
heading-top-padding
May 1, 2026
Merged

feat: additional heading top padding (BLO-1008)#2690
nperez0111 merged 1 commit intomainfrom
heading-top-padding

Conversation

@matthewlipski
Copy link
Copy Markdown
Collaborator

@matthewlipski matthewlipski commented Apr 29, 2026

Summary

This PR adds extra padding to the tops of heading blocks, as this makes it more clear that the heading relates to the content below it, not above it.

Closes #2414

Rationale

See above.

Changes

  • Added 15px padding to tops of headings.
  • Updated side menu styles to still be centered on headings.

Impact

N/A

Testing

Updated e2e screenshots.

Screenshots/Video

N/A

Checklist

  • Code follows the project's coding standards.
  • Unit tests covering the new feature have been added.
  • All existing tests pass.
  • The documentation has been updated to reflect the new feature

Additional Notes

N/A

Summary by CodeRabbit

  • Style

    • Enhanced visual consistency and usability by refining heading block spacing with adjusted padding and improving menu sizing across all heading levels, maintaining design harmony throughout the editor interface.
  • Tests

    • Updated end-to-end tests with simplified navigation approaches to improve test reliability and reduce maintenance complexity for future updates.

@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 29, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
blocknote Ready Ready Preview Apr 29, 2026 4:57pm
blocknote-website Ready Ready Preview Apr 29, 2026 4:57pm

Request Review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 29, 2026

📝 Walkthrough

Walkthrough

The changes adjust heading block spacing to follow typographic conventions by adding top padding to heading blocks and increasing side menu row heights for heading elements at different levels. Test cases are updated to accommodate the new layout changes.

Changes

Cohort / File(s) Summary
Heading Block Spacing
packages/core/src/editor/Block.css, packages/react/src/editor/styles.css
Added 18px top padding to heading blocks in Block.css. Increased side menu row heights for heading blocks in styles.css: H1 (78px→108px), H2 (54px→84px), H3 (37px→67px).
Test Updates
tests/src/end-to-end/multicolumn/multicolumn.test.ts
Removed unused H_ONE_BLOCK_SELECTOR import. Updated test to locate elements by visible text instead of selector, and adjusted cursor positioning logic with ArrowLeft before triggering delete action.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Suggested reviewers

  • nperez0111

Poem

🐰 Hop along with headings tall,
More space above—that's best for all!
With padding plush and heights so grand,
Typographic rules now sweetly stand.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title 'feat: Additional heading top padding (BLO-1008)' clearly and concisely describes the main change: adding top padding to heading blocks.
Description check ✅ Passed The description adequately covers all template sections with clear explanations of changes, rationale, testing approach, and completed checklist items.
Linked Issues check ✅ Passed The PR successfully implements the asymmetric vertical spacing requirement from issue #2414 by adding top padding to headings and adjusting side menu styles accordingly.
Out of Scope Changes check ✅ Passed All changes directly address the linked issue: CSS padding updates for headings, menu style adjustments to maintain centering, and test updates for visual regression verification.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ 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 heading-top-padding

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
Review rate limit: 7/8 reviews remaining, refill in 7 minutes and 30 seconds.

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

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

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 the current code and only fix it if needed.

Inline comments:
In `@packages/react/src/editor/styles.css`:
- Around line 245-255: The side-menu misses height overrides for heading levels
4–6 so those rows remain vertically offset; add selectors matching the existing
pattern (.bn-side-menu[data-block-type="heading"][data-level="4"],
..."[data-level="5"]", "[data-level="6"]) and set explicit height values for
each to re-center the side-menu rows (compute heights the same way you did for
levels 1–3 so they account for the extra top spacing applied in Block.css,
matching the centering logic used in
.bn-side-menu[data-block-type="heading"][data-level="1"/"2"/"3"]).
🪄 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: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 9fd2f6a2-0ebe-4005-91c9-ea6d08769c71

📥 Commits

Reviewing files that changed from the base of the PR and between ff052c8 and 44f6c43.

⛔ Files ignored due to path filters (30)
  • tests/src/end-to-end/colors/colors.test.ts-snapshots/backgroundColorMark-chromium-linux.png is excluded by !**/*.png
  • tests/src/end-to-end/colors/colors.test.ts-snapshots/backgroundColorMark-firefox-linux.png is excluded by !**/*.png
  • tests/src/end-to-end/colors/colors.test.ts-snapshots/backgroundColorMark-webkit-linux.png is excluded by !**/*.png
  • tests/src/end-to-end/colors/colors.test.ts-snapshots/blockBackgroundColor-chromium-linux.png is excluded by !**/*.png
  • tests/src/end-to-end/colors/colors.test.ts-snapshots/blockBackgroundColor-firefox-linux.png is excluded by !**/*.png
  • tests/src/end-to-end/colors/colors.test.ts-snapshots/blockBackgroundColor-webkit-linux.png is excluded by !**/*.png
  • tests/src/end-to-end/colors/colors.test.ts-snapshots/blockTextColor-chromium-linux.png is excluded by !**/*.png
  • tests/src/end-to-end/colors/colors.test.ts-snapshots/blockTextColor-firefox-linux.png is excluded by !**/*.png
  • tests/src/end-to-end/colors/colors.test.ts-snapshots/blockTextColor-webkit-linux.png is excluded by !**/*.png
  • tests/src/end-to-end/colors/colors.test.ts-snapshots/textColorMark-chromium-linux.png is excluded by !**/*.png
  • tests/src/end-to-end/colors/colors.test.ts-snapshots/textColorMark-firefox-linux.png is excluded by !**/*.png
  • tests/src/end-to-end/colors/colors.test.ts-snapshots/textColorMark-webkit-linux.png is excluded by !**/*.png
  • tests/src/end-to-end/draghandle/draghandle.test.ts-snapshots/draghandlemenu-chromium-linux.png is excluded by !**/*.png
  • tests/src/end-to-end/draghandle/draghandle.test.ts-snapshots/draghandlemenu-firefox-linux.png is excluded by !**/*.png
  • tests/src/end-to-end/draghandle/draghandle.test.ts-snapshots/draghandlemenu-webkit-linux.png is excluded by !**/*.png
  • tests/src/end-to-end/slashmenu/slashmenu.test.ts-snapshots/slash-menu-end-product-chromium-linux.png is excluded by !**/*.png
  • tests/src/end-to-end/slashmenu/slashmenu.test.ts-snapshots/slash-menu-end-product-firefox-linux.png is excluded by !**/*.png
  • tests/src/end-to-end/slashmenu/slashmenu.test.ts-snapshots/slash-menu-end-product-webkit-linux.png is excluded by !**/*.png
  • tests/src/end-to-end/static/static.test.ts-snapshots/static-rendering-chromium-linux.png is excluded by !**/*.png
  • tests/src/end-to-end/static/static.test.ts-snapshots/static-rendering-equality-chromium-linux.png is excluded by !**/*.png
  • tests/src/end-to-end/static/static.test.ts-snapshots/static-rendering-equality-firefox-linux.png is excluded by !**/*.png
  • tests/src/end-to-end/static/static.test.ts-snapshots/static-rendering-equality-webkit-linux.png is excluded by !**/*.png
  • tests/src/end-to-end/static/static.test.ts-snapshots/static-rendering-firefox-linux.png is excluded by !**/*.png
  • tests/src/end-to-end/static/static.test.ts-snapshots/static-rendering-webkit-linux.png is excluded by !**/*.png
  • tests/src/end-to-end/textalignment/textAlignment.test.ts-snapshots/alignTextMultipleBlocks-chromium-linux.png is excluded by !**/*.png
  • tests/src/end-to-end/textalignment/textAlignment.test.ts-snapshots/alignTextMultipleBlocks-firefox-linux.png is excluded by !**/*.png
  • tests/src/end-to-end/textalignment/textAlignment.test.ts-snapshots/alignTextMultipleBlocks-webkit-linux.png is excluded by !**/*.png
  • tests/src/end-to-end/textalignment/textAlignment.test.ts-snapshots/alignTextSingleBlock-chromium-linux.png is excluded by !**/*.png
  • tests/src/end-to-end/textalignment/textAlignment.test.ts-snapshots/alignTextSingleBlock-firefox-linux.png is excluded by !**/*.png
  • tests/src/end-to-end/textalignment/textAlignment.test.ts-snapshots/alignTextSingleBlock-webkit-linux.png is excluded by !**/*.png
📒 Files selected for processing (3)
  • packages/core/src/editor/Block.css
  • packages/react/src/editor/styles.css
  • tests/src/end-to-end/multicolumn/multicolumn.test.ts

Comment on lines 245 to 255
.bn-side-menu[data-block-type="heading"][data-level="1"] {
height: 78px;
height: 108px;
}

.bn-side-menu[data-block-type="heading"][data-level="2"] {
height: 54px;
height: 84px;
}

.bn-side-menu[data-block-type="heading"][data-level="3"] {
height: 37px;
height: 67px;
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Add side-menu height overrides for heading levels 4–6.

packages/core/src/editor/Block.css Line 130 applies extra top spacing to all headings, but this file only re-centers side-menu rows for levels 1–3. Levels 4–6 still use the 30px fallback and will be vertically off.

💡 Proposed CSS extension
 .bn-side-menu[data-block-type="heading"][data-level="3"] {
   height: 67px;
 }
+
+.bn-side-menu[data-block-type="heading"][data-level="4"] {
+  height: 60px;
+}
+
+.bn-side-menu[data-block-type="heading"][data-level="5"] {
+  height: 58px;
+}
+
+.bn-side-menu[data-block-type="heading"][data-level="6"] {
+  height: 55px;
+}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/react/src/editor/styles.css` around lines 245 - 255, The side-menu
misses height overrides for heading levels 4–6 so those rows remain vertically
offset; add selectors matching the existing pattern
(.bn-side-menu[data-block-type="heading"][data-level="4"],
..."[data-level="5"]", "[data-level="6"]) and set explicit height values for
each to re-center the side-menu rows (compute heights the same way you did for
levels 1–3 so they account for the extra top spacing applied in Block.css,
matching the centering logic used in
.bn-side-menu[data-block-type="heading"][data-level="1"/"2"/"3"]).

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Apr 29, 2026

Open in StackBlitz

@blocknote/ariakit

npm i https://pkg.pr.new/@blocknote/ariakit@2690

@blocknote/code-block

npm i https://pkg.pr.new/@blocknote/code-block@2690

@blocknote/core

npm i https://pkg.pr.new/@blocknote/core@2690

@blocknote/mantine

npm i https://pkg.pr.new/@blocknote/mantine@2690

@blocknote/react

npm i https://pkg.pr.new/@blocknote/react@2690

@blocknote/server-util

npm i https://pkg.pr.new/@blocknote/server-util@2690

@blocknote/shadcn

npm i https://pkg.pr.new/@blocknote/shadcn@2690

@blocknote/xl-ai

npm i https://pkg.pr.new/@blocknote/xl-ai@2690

@blocknote/xl-docx-exporter

npm i https://pkg.pr.new/@blocknote/xl-docx-exporter@2690

@blocknote/xl-email-exporter

npm i https://pkg.pr.new/@blocknote/xl-email-exporter@2690

@blocknote/xl-multi-column

npm i https://pkg.pr.new/@blocknote/xl-multi-column@2690

@blocknote/xl-odt-exporter

npm i https://pkg.pr.new/@blocknote/xl-odt-exporter@2690

@blocknote/xl-pdf-exporter

npm i https://pkg.pr.new/@blocknote/xl-pdf-exporter@2690

commit: 44f6c43

Copy link
Copy Markdown
Contributor

@nperez0111 nperez0111 left a comment

Choose a reason for hiding this comment

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

I've been meaning to do this for a long time

@nperez0111 nperez0111 changed the title feat: Additional heading top padding (BLO-1008) feat: additional heading top padding (BLO-1008) May 1, 2026
@nperez0111 nperez0111 merged commit 8508f81 into main May 1, 2026
23 checks passed
@nperez0111 nperez0111 deleted the heading-top-padding branch May 1, 2026 07:05
@YousefED
Copy link
Copy Markdown
Collaborator

YousefED commented May 2, 2026

@matthewlipski While this addresses the issue, we could explore some nest steps.

For example:

  • make the margin / padding dependent on font-size / heading level.
  • make it easier to configure / change heading sizes
    -- make it easier for BlockNote conform to the rest of a users application CSS (not 100% sure if this is feasible / desired)

you can research some typography patterns like:

(this was a quick search, there are probably some design blogs written about this as well)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Headings should have more space above than below (typographic convention)

3 participants