Skip to content

Commit f700f76

Browse files
authored
fix: fix issue with textarea focus requiring 2 clicks (#680)
1 parent 36cbdcc commit f700f76

2 files changed

Lines changed: 7 additions & 8 deletions

File tree

.changeset/chilly-planes-heal.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@blinkk/root-cms': patch
3+
---
4+
5+
fix: fix issue with textarea focus requiring 2 clicks

packages/root-cms/ui/components/DocEditor/fields/StringField.tsx

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import {FieldProps} from './FieldProps.js';
77
export function StringField(props: FieldProps) {
88
const field = props.field as schema.StringField;
99
const [value, setValue] = useState('');
10-
const [autosize, setAutosize] = useState(false);
1110

1211
function onChange(newValue: string) {
1312
setValue(newValue);
@@ -29,18 +28,13 @@ export function StringField(props: FieldProps) {
2928
<Textarea
3029
size="xs"
3130
radius={0}
32-
autosize={autosize}
33-
minRows={3}
31+
autosize={false}
32+
minRows={4}
3433
maxRows={field.maxRows || 12}
3534
value={value}
3635
onChange={(e: ChangeEvent<HTMLTextAreaElement>) => {
3736
onChange(e.currentTarget.value);
3837
}}
39-
onFocus={() => {
40-
if (!autosize) {
41-
setAutosize(true);
42-
}
43-
}}
4438
/>
4539
);
4640
}

0 commit comments

Comments
 (0)