Skip to content

Forms block: add a layout attribute (stacked / inline) - #917

Merged
ViewFromTheBox merged 1 commit into
release/1.15.2from
enhancement/916-form-layout
Oct 17, 2026
Merged

ViewFromTheBox merged 1 commit into
release/1.15.2from
enhancement/916-form-layout

Conversation

@ViewFromTheBox

Copy link
Copy Markdown
Member

Description

The Forms block (artisanpack/form) gets a Layout setting: Stacked (the default) or Inline.

Closes: #916

Type of Change

  • Enhancement (improves existing functionality)

Related Issue

Issue: #916

Motivation and Context

Short forms such as newsletter signups need the email field and submit button on one row. The forms package now supports layout: 'inline' (ArtisanPack-UI/forms#141, PR #142), and the host island reads it from the wrapper (Keystone #423, MR !308).

Changes Made

  • block.json: new layout attribute (stacked | inline, default stacked).
  • edit.tsx:
    • A Layout toggle in the Form settings panel, with help text.
    • When inline, the canvas preview puts the fields and button on one wrapping row (fields flex: 1 1 12rem; min-width: min(12rem, 100%), button bottom-aligned).
  • FormBlock.php:
    • validateAttrs() keeps layout only when it's stacked or inline.
    • render() adds is-layout-inline and data-layout="inline" only when inline, so stacked output is byte-identical.
  • CHANGELOG: entry added.
  • React/Vue renderers: they don't render artisanpack/form, so there's no parity change.

How Has This Been Tested?

Testing Environment:

  • Operating System: macOS
  • Browser (if applicable): Chromium (Playwright headless shell)
  • PHP Version: 8.5 (package), 8.4 (Keystone install)
  • Project Version: release/1.15.2

Tests Performed:

  1. FormBlock tests: 23 passed (6 new). Full Pest suite: 3658 passed, 1 skipped.
  2. Vitest: 3 new form-block edit tests; full suite 4917 passed.
  3. npm run build and npm run build:lib succeed.
  4. Symlinked into a Keystone 0.15.2 install with the island change:
    • The inline block renders is-layout-inline / data-layout="inline", and the email field and button sit on one row (wrapping at 375px, no horizontal scroll).
    • The stacked block is unchanged.

Accessibility Tests Run

  • Keyboard navigation tested
  • Screen reader tested
  • Color contrast verified
  • ARIA labels checked

Details: Layout-only. The inspector control is a standard toggle group with a visible label and help text.

Tests Added

  • Unit tests added/updated
  • Integration tests added/updated
  • All tests passing

Documentation

  • Inline code documentation added

Documentation details: CHANGELOG entry. docs/blocks.md lists the Forms block without attributes, so it's unchanged. The .pot file is regenerated at release time; the new strings are "Layout", "Stacked", "Inline" and the help text.

Pre-Submission Checklist

  • Code passes all tests
  • Code follows project style guide (php-cs-fixer)
  • Self-review completed

- block.json: layout enum (stacked | inline), default stacked.
- edit.tsx: Layout toggle in Form settings; the canvas preview puts
  fields and the button on one wrapping row when inline.
- FormBlock: validateAttrs keeps only valid layouts; render adds
  data-layout="inline" and is-layout-inline only when inline, so
  stacked output is byte-identical. Placeholders are unchanged.
- save.tsx returns null (dynamic block), so no deprecation is needed.
- React/Vue renderers don't render artisanpack/form; no parity change.

Closes #916
@coderabbitai

coderabbitai Bot commented Oct 17, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 15 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Repository: ArtisanPack-UI/visual-editor/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 2ed5b3b3-a859-4403-924b-506912fbf215
📥 Commits

Reviewing files that changed from the base of the PR and between 1025a4f and 70c9c61.

📒 Files selected for processing: 6
  • CHANGELOG.md
  • resources/js/visual-editor/blocks/form/__tests__/edit.test.tsx
  • resources/js/visual-editor/blocks/form/block.json
  • resources/js/visual-editor/blocks/form/edit.tsx
  • src/Blocks/Forms/FormBlock.php
  • tests/Unit/VisualEditor/Blocks/Forms/FormBlockTest.php
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@ViewFromTheBox
ViewFromTheBox merged commit 35ae719 into release/1.15.2 Oct 17, 2026
5 checks passed
@github-project-automation github-project-automation Bot moved this from Backlog to Done in ArtisanPack UI Overview Oct 17, 2026
@ViewFromTheBox
ViewFromTheBox deleted the enhancement/916-form-layout branch October 17, 2026 15:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

1 participant