From 7b60cc63ce0b8e19e4600f50f3415b10ae5809f1 Mon Sep 17 00:00:00 2001 From: Ian Philips Date: Mon, 11 Jul 2022 09:56:10 -0600 Subject: [PATCH] Fix annoying create description scrolling on firefox --- web/pages/create.tsx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/web/pages/create.tsx b/web/pages/create.tsx index f9b0dd00..fd071310 100644 --- a/web/pages/create.tsx +++ b/web/pages/create.tsx @@ -101,7 +101,7 @@ export function NewContract(props: { (params?.outcomeType as outcomeType) ?? 'BINARY' ) const [initialProb] = useState(50) - + const [bottomRef, setBottomRef] = useState(null) const [minString, setMinString] = useState(params?.min ?? '') const [maxString, setMaxString] = useState(params?.max ?? '') const [isLogScale, setIsLogScale] = useState(!!params?.isLogScale) @@ -185,7 +185,6 @@ export function NewContract(props: { if (!creator || !isValid) return setIsSubmitting(true) - // TODO: add contract id to the group contractIds try { const result = await createMarket( removeUndefinedProps({ @@ -410,8 +409,12 @@ export function NewContract(props: { value={description} disabled={isSubmitting} onClick={(e) => e.stopPropagation()} - onChange={(e) => setDescription(e.target.value || '')} + onChange={(e) => { + setDescription(e.target.value || '') + bottomRef?.scrollIntoView() + }} /> +