8000 feat: section anchors, tabs opened from the URL, slider peek, gutter by Klehm · Pull Request #102 · Klehm/content-blocks-project · GitHub
[go: up one dir, main page]

Skip to content

feat: section anchors, tabs opened from the URL, slider peek, gutter - #102

Merged
Klehm merged 1 commit into
masterfrom
feat/anchors-tabs-slider-kit
Dec 2, 2026
Merged

Klehm merged 1 commit into
masterfrom
feat/anchors-tabs-slider-kit

Conversation

@Klehm
@Klehm Klehm commented Dec 2, 2026
Copy link
Copy Markdown
Owner

Core

  • Section anchor: an Anchor field in the section sidebar's Advanced panel (anchor setting, allowed in presets) becomes the section's id. A pasted # is dropped and spaces become dashes; a value that cannot be an id is refused in the sidebar and checked again at render (import, presets and templates bypass the form). Two sections with the same anchor both render; the area render gives the id to the first one only. The builder's patchSection now copies the id. Exposed as sections[].anchor in the headless tree.
  • Tab or panel opened from the URL: #anchor-2 opens the second tab or accordion panel of the section anchored anchor (counted from 1). A panel's own id, or the id of anything inside a closed panel, works too, on load and on hashchange. assets/panels.js is served by a new public route, content_blocks_asset_panels, and linked only by public pages with tabs or an accordion.
  • Slider peek (sliderPeek): the slides narrow so that the start of the next one shows. The sliver is --cb-slide-peek (12% of the row by default). A slider without the option keeps its exact widths.
  • Section gutter: content_blocks.section.gutter (a CSS length, null by default) gives every section an inline padding. A section's own left/right padding still wins, and --cb-section-gutter overrides it from the host's CSS. Opt-in, so no existing public page moves.
  • The near-miss check on preset / initial-settings keys now accepts a key that extends a core key (anchorId), which the new anchor key would otherwise have refused.

Kit

  • Open in a new tab (newTab) on card buttons, gallery image links and the image block's link.
  • Image height per viewport: Height on tablet / Height on mobile, available with a fixed custom height; blank inherits. Without them the markup is unchanged.
  • Video: a YouTube or Vimeo URL pasted as the file is refused with a message pointing to the Video embed block. The error stays on that field, so the other fields still save.

Tests

  • PHPUnit: core 1493, kit 422, satellites green.
  • Vitest: core 598 (new panels.test.js), kit 70.
  • New e2e spec section-anchor.spec.js (anchor + tab from the URL, refused anchor, slider peek). Main suite 263 and Encore suite 11 pass.
  • PHPStan and php-cs-fixer clean.

Core:
- A section can have an anchor (its id), set in the Advanced panel; the
  area render keeps the first of two equal ids.
- #anchor-N opens the Nth tab or accordion panel, through a small public
  script linked only by pages with tabs or an accordion.
- sliderPeek shows a sliver of the next slide.
- content_blocks.section.gutter: an opt-in inline padding for every
  section, overridable with --cb-section-gutter.
- A preset key extending a core key (anchorId) is no longer a typo.

Kit:
- Open in a new tab on card buttons, gallery links and the image link.
- An image's fixed height per viewport (tablet, mobile).
- A YouTube or Vimeo link pasted as a video file is refused.
@Klehm
Klehm merged commit 2988817 into master Dec 2, 2026
53 checks passed
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.

1 participant

0