Skip to content

Commit 3bd71ad

Browse files
authored
fix: use baseline alignment on auto responsive form layout (#9865)
1 parent 6947b9d commit 3bd71ad

File tree

4 files changed

+20
-1
lines changed

4 files changed

+20
-1
lines changed

packages/form-layout/src/styles/vaadin-form-layout-base-styles.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ export const formLayoutStyles = css`
8888
grid-auto-columns: 0;
8989
9090
grid-template-columns: repeat(auto-fill, var(--_grid-repeat));
91-
justify-items: start;
91+
place-items: baseline start;
9292
9393
/*
9494
Firefox requires min-width on both :host and #layout to allow the layout

packages/form-layout/test/form-layout-auto-responsive.test.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,8 @@ describe('form-layout auto responsive', () => {
287287

288288
it('should update layout after adding a field to a row', async () => {
289289
const newField = document.createElement('input');
290+
// There is a Safari bug that leads to incorrect calculation for baseline alignment of empty inputs
291+
newField.placeholder = 'Middle name';
290292
rows[0].appendChild(newField);
291293
await nextFrame();
292294
assertFormLayoutGrid(layout, { columns: 3, rows: 2 });

packages/form-layout/test/visual/base/form-layout-auto-responsive.test.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -441,4 +441,21 @@ describe('form-layout auto responsive', () => {
441441
await visualDiff(container, 'fields-with-explicit-width-expand-fields');
442442
});
443443
});
444+
445+
it('baseline alignment', async () => {
446+
element = fixtureSync(
447+
`
448+
<vaadin-form-layout auto-responsive>
449+
<vaadin-form-row>
450+
<label style="height: 20px; line-height: 20px; margin: 10px;">Subscribe</label>
451+
<input type="checkbox" style="width: 20px; height: 20px; margin: 20px;" />
452+
<textarea placeholder="Comments" style="height: 60px; padding: 8px;"></textarea>
453+
</vaadin-form-row>
454+
</vaadin-form-layout>
455+
`,
456+
container,
457+
);
458+
await nextResize(element);
459+
await visualDiff(container, 'baseline-alignment');
460+
});
444461
});
1.93 KB
Loading

0 commit comments

Comments
 (0)