mirror of
https://github.com/filecoin-project/slate.git
synced 2024-11-23 14:07:20 +03:00
fix(GlobalCarousel/EditInfo/Description field): scroll to bottom on event
This commit is contained in:
parent
8980059a76
commit
51d938da77
@ -63,11 +63,11 @@ function UpdateFileForm({ file, isMobile, onClose }) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
//NOTE(amine): scroll to the bottom of the form every time the description's textarea resizes
|
//NOTE(amine): scroll to the bottom of the form every time the description's textarea resizes
|
||||||
React.useLayoutEffect(() => {
|
const scrollToFormBottom = () => {
|
||||||
const form = formRef.current;
|
const form = formRef.current;
|
||||||
if (!form) return;
|
if (!form) return;
|
||||||
form.scrollTop = form.scrollHeight - form.clientHeight;
|
form.scrollTop = form.scrollHeight - form.clientHeight;
|
||||||
}, [values.description]);
|
};
|
||||||
|
|
||||||
const JumperItem = isMobile ? MobileJumper.Content : Jumper.Item;
|
const JumperItem = isMobile ? MobileJumper.Content : Jumper.Item;
|
||||||
|
|
||||||
@ -105,7 +105,7 @@ function UpdateFileForm({ file, isMobile, onClose }) {
|
|||||||
css={STYLES_EDIT_INFO_INPUT}
|
css={STYLES_EDIT_INFO_INPUT}
|
||||||
style={{ marginTop: 6 }}
|
style={{ marginTop: 6 }}
|
||||||
maxLength="2000"
|
maxLength="2000"
|
||||||
{...getFieldProps("description")}
|
{...getFieldProps("description", { onChange: scrollToFormBottom })}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</JumperItem>
|
</JumperItem>
|
||||||
|
Loading…
Reference in New Issue
Block a user