Skip to content

Commit 315b4e5

Browse files
authored
fix(ui): jumping hasmany uploads when form is submitting or in readonly mode (#9198)
1 parent 2d7626c commit 315b4e5

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

packages/ui/src/fields/Upload/HasMany/index.scss

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,14 @@
55
position: relative;
66
max-width: 100%;
77

8+
&__drag {
9+
&[aria-disabled='true'] {
10+
&:hover {
11+
cursor: default;
12+
}
13+
}
14+
}
15+
816
&__draggable-rows {
917
display: flex;
1018
flex-direction: column;

packages/ui/src/fields/Upload/HasMany/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ export function UploadComponentHasMany(props: Props) {
7676
}
7777

7878
return (
79-
<DraggableSortableItem disabled={!isSortable} id={id} key={id}>
79+
<DraggableSortableItem disabled={!isSortable || readonly} id={id} key={id}>
8080
{(draggableSortableItemProps) => (
8181
<div
8282
className={[
@@ -93,7 +93,7 @@ export function UploadComponentHasMany(props: Props) {
9393
}}
9494
>
9595
<UploadCard size="small">
96-
{isSortable && draggableSortableItemProps && (
96+
{draggableSortableItemProps && (
9797
<div
9898
className={`${baseClass}__drag`}
9999
{...draggableSortableItemProps.attributes}

packages/ui/src/fields/Upload/Input.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ export function UploadInput(props: UploadInputProps) {
158158
const loadedValueDocsRef = React.useRef<boolean>(false)
159159

160160
const canCreate = useMemo(() => {
161-
if (readOnly || !allowCreate) {
161+
if (!allowCreate) {
162162
return false
163163
}
164164

@@ -558,7 +558,7 @@ export function UploadInput(props: UploadInputProps) {
558558
/>
559559
</div>
560560

561-
{canCreate && (
561+
{canCreate && !readOnly && (
562562
<p className={`${baseClass}__dragAndDropText`}>
563563
{t('general:or')} {t('upload:dragAndDrop')}
564564
</p>

0 commit comments

Comments
 (0)