mirror of
https://github.com/filecoin-project/slate.git
synced 2024-11-09 20:28:29 +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
|
||||
React.useLayoutEffect(() => {
|
||||
const scrollToFormBottom = () => {
|
||||
const form = formRef.current;
|
||||
if (!form) return;
|
||||
form.scrollTop = form.scrollHeight - form.clientHeight;
|
||||
}, [values.description]);
|
||||
};
|
||||
|
||||
const JumperItem = isMobile ? MobileJumper.Content : Jumper.Item;
|
||||
|
||||
@ -105,7 +105,7 @@ function UpdateFileForm({ file, isMobile, onClose }) {
|
||||
css={STYLES_EDIT_INFO_INPUT}
|
||||
style={{ marginTop: 6 }}
|
||||
maxLength="2000"
|
||||
{...getFieldProps("description")}
|
||||
{...getFieldProps("description", { onChange: scrollToFormBottom })}
|
||||
/>
|
||||
</div>
|
||||
</JumperItem>
|
||||
|
Loading…
Reference in New Issue
Block a user