Docs: Prevent heading anchor cutoff on docs pages#34945
Conversation
Co-authored-by: Sidnioulz <5108577+Sidnioulz@users.noreply.github.com>
…nt anchor link cutoff Co-authored-by: Sidnioulz <5108577+Sidnioulz@users.noreply.github.com>
Package BenchmarksCommit: No significant changes detected, all good. 👏 |
Sidnioulz
left a comment
There was a problem hiding this comment.
Add a story for DocsPage that shows the behaviour of the page with a narrow viewport; the narrow viewport must also be configured for Chromatic so we get VRT.
Sidnioulz
left a comment
There was a problem hiding this comment.
Reduce the padding right of the anchor from 10px to 8px, and make sure the anchor uses small padding / small size if it uses the Button component
Co-authored-by: Sidnioulz <5108577+Sidnioulz@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Adjusts docs page padding and heading anchor spacing so the anchor icon isn't clipped on narrow viewports.
Changes:
- Increase
DocsWrapperhorizontal padding from20pxto40px. - Reduce
OcticonAnchorWrapperpaddingRightfrom10pxto8px. - Add
padding="small"to the heading anchorButtonfor more compact spacing.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| code/addons/docs/src/blocks/components/DocsPage.tsx | Bumps DocsWrapper horizontal padding to prevent anchor cutoff. |
| code/addons/docs/src/blocks/blocks/mdx.tsx | Tightens anchor wrapper padding and uses compact button spacing. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Actionable comments posted: 0 |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughRefactors MDX heading anchor alignment/styling and reorders the octicon/button markup; adds a small HeaderTitle. Increases DocsWrapper horizontal padding from 20px to 40px. ChangesDocs spacing refinements
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
✨ Finishing Touches📝 Generate docstrings
Comment |
|
Actionable comments posted: 0 |
|
Actionable comments posted: 0 |
Closes #31505
What I did
DocsWrapperpadding from4rem 20pxto4rem 40pxin:/home/runner/work/storybook/storybook/code/addons/docs/src/blocks/components/DocsPage.tsxChecklist for Contributors
Testing
The changes in this PR are covered in the following automated tests:
Manual testing
## Controls).Documentation
MIGRATION.MD
Checklist for Maintainers
When this PR is ready for testing, make sure to add
ci:normal,ci:mergedorci:dailyGH label to it to run a specific set of sandboxes. The particular set of sandboxes can be found incode/lib/cli-storybook/src/sandbox-templates.tsMake sure this PR contains one of the labels below:
Available labels
bug: Internal changes that fixes incorrect behavior.maintenance: User-facing maintenance tasks.dependencies: Upgrading (sometimes downgrading) dependencies.build: Internal-facing build tooling & test updates. Will not show up in release changelog.cleanup: Minor cleanup style change. Will not show up in release changelog.documentation: Documentation only changes. Will not show up in release changelog.feature request: Introducing a new feature.BREAKING CHANGE: Changes that break compatibility in some way with current major version.other: Changes that don't fit in the above categories.🦋 Canary release
This PR does not have a canary release associated. You can request a canary release of this pull request by mentioning the
@storybookjs/coreteam here.core team members can create a canary release here or locally with
gh workflow run --repo storybookjs/storybook publish.yml --field pr=<PR_NUMBER>Summary by CodeRabbit