Skip to content

Commit 443a61e

Browse files
authored
fix(swap): select network outside click on mobile (#6603) (#6604)
1 parent dd05bb7 commit 443a61e

File tree

1 file changed

+3
-2
lines changed
  • apps/cowswap-frontend/src/legacy/components/Header/NetworkSelector

1 file changed

+3
-2
lines changed

apps/cowswap-frontend/src/legacy/components/Header/NetworkSelector/index.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ export function NetworkSelector(): ReactNode {
159159
const { chainId } = useWalletInfo()
160160
const node = useRef<HTMLDivElement>(null)
161161
const nodeMobile = useRef<HTMLDivElement>(null)
162+
const nodeSelector = useRef<HTMLDivElement>(null)
162163
const isOpen = useModalIsOpen(ApplicationModal.NETWORK_SELECTOR)
163164
const toggleModal = useToggleModal(ApplicationModal.NETWORK_SELECTOR)
164165

@@ -169,7 +170,7 @@ export function NetworkSelector(): ReactNode {
169170
const info = getChainInfo(chainId)
170171
const isUpToMedium = useMediaQuery(Media.upToMedium(false))
171172

172-
useOnClickOutside(isUpToMedium ? [nodeMobile] : [node], () => {
173+
useOnClickOutside(isUpToMedium ? [nodeMobile, nodeSelector] : [node], () => {
173174
if (isOpen) {
174175
toggleModal()
175176
}
@@ -187,7 +188,7 @@ export function NetworkSelector(): ReactNode {
187188

188189
return (
189190
<SelectorWrapper ref={node} onClick={toggleModal}>
190-
<SelectorControls isChainIdUnsupported={isChainIdUnsupported}>
191+
<SelectorControls ref={nodeSelector} isChainIdUnsupported={isChainIdUnsupported}>
191192
{!isChainIdUnsupported ? (
192193
<>
193194
<SelectorLogo src={logoUrl} />

0 commit comments

Comments
 (0)