diff --git a/libs/remix-ui/run-tab/src/lib/components/contractDropdownUI.tsx b/libs/remix-ui/run-tab/src/lib/components/contractDropdownUI.tsx index 2bed9523aa..0988e9e95c 100644 --- a/libs/remix-ui/run-tab/src/lib/components/contractDropdownUI.tsx +++ b/libs/remix-ui/run-tab/src/lib/components/contractDropdownUI.tsx @@ -1,5 +1,5 @@ // eslint-disable-next-line no-use-before-define -import React, { useEffect, useState } from 'react' +import React, { useEffect, useRef, useState } from 'react' import { ContractData, ContractDropdownProps, FuncABI } from '../types' import * as ethJSUtil from 'ethereumjs-util' import { ContractGUI } from './contractGUI' @@ -26,6 +26,7 @@ export function ContractDropdownUI (props: ContractDropdownProps) { const [loadedContractData, setLoadedContractData] = useState(null) const [constructorInterface, setConstructorInterface] = useState(null) const [constructorInputs, setConstructorInputs] = useState(null) + const contractsRef = useRef(null) const { contractList, loadType, currentFile, compilationCount } = props.contracts useEffect(() => { @@ -101,6 +102,10 @@ export function ContractDropdownUI (props: ContractDropdownProps) { const contract = contracts.find(contract => contract.alias === selectedContract) if (!selectedContract || !contract) setSelectedContract(contracts[0].alias) + contractsRef.current.focus() + setTimeout(() => { + contractsRef.current.blur() + }, 1000) } } @@ -203,7 +208,7 @@ export function ContractDropdownUI (props: ContractDropdownProps) {
- { (contractList[currentFile] || []).map((contract, index) => { return }) }