Skip to content

Add FormLayout context awareness to Button#698

Open
adamkudrna wants to merge 2 commits intomasterfrom
feature/button-in-form-layout
Open

Add FormLayout context awareness to Button#698
adamkudrna wants to merge 2 commits intomasterfrom
feature/button-in-form-layout

Conversation

@adamkudrna
Copy link
Member

@adamkudrna adamkudrna commented Mar 18, 2026

Add FormLayout context awareness to Button:

obrazek

Summary

  • Button now detects FormLayoutContext and applies isRootInFormLayout
    (justify-self: start) to prevent full-width stretching in both vertical
    and horizontal layouts
  • In horizontal FormLayout, isRootLayoutHorizontal places the button in
    the field column (grid-column-start: 2) above the md breakpoint,
    aligning it with adjacent form fields
  • Adds ButtonForFormLayoutTests story component and formLayout visual
    test suite mirroring the pattern from TextField
  • Updates FormLayout README to document Button as a supported component
    and moves the full-form example to a more prominent place near the top

Button now detects FormLayoutContext and applies `isRootInFormLayout`
(justify-self: start) and `isRootLayoutHorizontal` (grid-column-start: 2
above md breakpoint), matching the pattern used by all other form fields.
Also updates FormLayout README to document Button support and adds
Playwright component tests for the new FormLayout integration.
@github-project-automation github-project-automation bot moved this to 💡Ideas in The Board Mar 18, 2026
@adamkudrna adamkudrna moved this from 💡Ideas to 👀 In review in The Board Mar 18, 2026
@adamkudrna
Copy link
Member Author

adamkudrna commented Mar 18, 2026

👉 Thorough test coverage of Button behavior in the FormLayout context added in #699.


return (
<FormLayoutContext.Provider value={values}>
<Button
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should place two Buttons here, so that the snapshots would actually differ somehow.

See:

Copy link
Member Author

Choose a reason for hiding this comment

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

The snapshots will remain identical within FormLayoutContext, unless they are placed into a real <FormLayout> with CSS grid. This update only affects the placement of the Button within the grid, it does not alter the Button itself.

Copy link
Contributor

Choose a reason for hiding this comment

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

The snapshots will remain identical within FormLayoutContext, unless they are placed into a real with CSS grid

I see.

My suggestion is wrong, but the problem is still there. We have a test that does not really test anything as the snapshots for horizontal and vertical layouts are the same.

I see as possible solutions:

  1. Add other elements that will make the difference visible
  2. Use non visual test to validate correct CSS classes
  3. ???

I think I like 1) more then 2).

Copy link
Member Author

Choose a reason for hiding this comment

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

OK, here it is.

@adamkudrna adamkudrna requested a review from mbohal March 23, 2026 16:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: 👀 In review

Development

Successfully merging this pull request may close these issues.

2 participants