Skip to content

Commit e6d0443

Browse files
authored
fix(ui): fixes layout shift when form is submitted (#9184)
Some fields cause layout shift when you submit the form. This PR reduces that flicker.
1 parent 81099cb commit e6d0443

File tree

4 files changed

+16
-6
lines changed

4 files changed

+16
-6
lines changed

packages/richtext-lexical/src/field/index.scss

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,17 @@
2323
&--read-only {
2424
.editor-container {
2525
.editor {
26-
background: var(--theme-elevation-200);
26+
@keyframes fadeInBackground {
27+
from {
28+
background-color: transparent;
29+
}
30+
to {
31+
background-color: var(--theme-elevation-100);
32+
}
33+
}
34+
35+
animation: fadeInBackground 0.5s ease forwards;
2736
color: var(--theme-elevation-450);
28-
padding: calc(var(--base) * 0.5);
2937
}
3038
}
3139
}

packages/ui/src/fields/Array/index.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,10 +335,11 @@ export const ArrayFieldComponent: ArrayFieldClientComponent = (props) => {
335335
)}
336336
</DraggableSortable>
337337
)}
338-
{!readOnly && !hasMaxRows && (
338+
{!hasMaxRows && (
339339
<Button
340340
buttonStyle="icon-label"
341341
className={`${baseClass}__add-row`}
342+
disabled={readOnly}
342343
icon="plus"
343344
iconPosition="left"
344345
iconStyle="with-border"

packages/ui/src/fields/Blocks/index.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,11 +325,12 @@ const BlocksFieldComponent: BlocksFieldClientComponent = (props) => {
325325
)}
326326
</DraggableSortable>
327327
)}
328-
{!readOnly && !hasMaxRows && (
328+
{!hasMaxRows && (
329329
<Fragment>
330330
<DrawerToggler className={`${baseClass}__drawer-toggler`} slug={drawerSlug}>
331331
<Button
332332
buttonStyle="icon-label"
333+
disabled={readOnly}
333334
el="span"
334335
icon="plus"
335336
iconPosition="left"

packages/ui/src/scss/vars.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,8 @@ $focus-box-shadow: 0 0 0 $style-stroke-width-m var(--theme-success-500);
141141
line-height: base(1);
142142
padding: base(0.4) base(0.75);
143143
-webkit-appearance: none;
144-
transition-property: border, box-shadow;
145-
transition-duration: 100ms;
144+
transition-property: border, box-shadow, background-color;
145+
transition-duration: 100ms, 100ms, 500ms;
146146
transition-timing-function: cubic-bezier(0, 0.2, 0.2, 1);
147147

148148
&[data-rtl='true'] {

0 commit comments

Comments
 (0)