Fix annoying create description scrolling on firefox

This commit is contained in:
Ian Philips 2022-07-11 09:56:10 -06:00
parent 9b252b93ab
commit 7b60cc63ce

View File

@ -101,7 +101,7 @@ export function NewContract(props: {
(params?.outcomeType as outcomeType) ?? 'BINARY' (params?.outcomeType as outcomeType) ?? 'BINARY'
) )
const [initialProb] = useState(50) const [initialProb] = useState(50)
const [bottomRef, setBottomRef] = useState<HTMLDivElement | null>(null)
const [minString, setMinString] = useState(params?.min ?? '') const [minString, setMinString] = useState(params?.min ?? '')
const [maxString, setMaxString] = useState(params?.max ?? '') const [maxString, setMaxString] = useState(params?.max ?? '')
const [isLogScale, setIsLogScale] = useState<boolean>(!!params?.isLogScale) const [isLogScale, setIsLogScale] = useState<boolean>(!!params?.isLogScale)
@ -185,7 +185,6 @@ export function NewContract(props: {
if (!creator || !isValid) return if (!creator || !isValid) return
setIsSubmitting(true) setIsSubmitting(true)
// TODO: add contract id to the group contractIds
try { try {
const result = await createMarket( const result = await createMarket(
removeUndefinedProps({ removeUndefinedProps({
@ -410,8 +409,12 @@ export function NewContract(props: {
value={description} value={description}
disabled={isSubmitting} disabled={isSubmitting}
onClick={(e) => e.stopPropagation()} onClick={(e) => e.stopPropagation()}
onChange={(e) => setDescription(e.target.value || '')} onChange={(e) => {
setDescription(e.target.value || '')
bottomRef?.scrollIntoView()
}}
/> />
<div ref={setBottomRef} />
</div> </div>
<Spacer h={6} /> <Spacer h={6} />