Add FormLayout context awareness to Button#698
Conversation
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.
|
👉 Thorough test coverage of |
|
|
||
| return ( | ||
| <FormLayoutContext.Provider value={values}> | ||
| <Button |
There was a problem hiding this comment.
I think we should place two Buttons here, so that the snapshots would actually differ somehow.
See:
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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:
- Add other elements that will make the difference visible
- Use non visual test to validate correct CSS classes
- ???
I think I like 1) more then 2).
Add
FormLayoutcontext awareness toButton:Summary
Buttonnow detectsFormLayoutContextand appliesisRootInFormLayout(
justify-self: start) to prevent full-width stretching in both verticaland horizontal layouts
FormLayout,isRootLayoutHorizontalplaces the button inthe field column (
grid-column-start: 2) above themdbreakpoint,aligning it with adjacent form fields
ButtonForFormLayoutTestsstory component andformLayoutvisualtest suite mirroring the pattern from
TextFieldFormLayoutREADME to documentButtonas a supported componentand moves the full-form example to a more prominent place near the top