From f7c6b3228b7ac0a94a98356415a465157091c31e Mon Sep 17 00:00:00 2001 From: ryanml Date: Mon, 15 Nov 2021 17:00:23 -0700 Subject: [PATCH] Scroll to "show test networks" setting from network dropdown link (#12711) * Scroll to "show test networks" setting from network dropdown link * Focusing element --- ui/components/app/dropdowns/network-dropdown.js | 2 +- .../settings/advanced-tab/advanced-tab.component.js | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/ui/components/app/dropdowns/network-dropdown.js b/ui/components/app/dropdowns/network-dropdown.js index 7838a9864..13b58e0d8 100644 --- a/ui/components/app/dropdowns/network-dropdown.js +++ b/ui/components/app/dropdowns/network-dropdown.js @@ -324,7 +324,7 @@ class NetworkDropdown extends Component { onClick={(e) => { e.preventDefault(); hideNetworkDropdown(); - history.push(ADVANCED_ROUTE); + history.push(`${ADVANCED_ROUTE}#show-testnets`); }} > {t('here')} diff --git a/ui/pages/settings/advanced-tab/advanced-tab.component.js b/ui/pages/settings/advanced-tab/advanced-tab.component.js index 361c7d8c9..c24ddb868 100644 --- a/ui/pages/settings/advanced-tab/advanced-tab.component.js +++ b/ui/pages/settings/advanced-tab/advanced-tab.component.js @@ -61,6 +61,15 @@ export default class AdvancedTab extends PureComponent { showLedgerTransportWarning: false, }; + showTestNetworksRef = React.createRef(); + + componentDidMount() { + if (window.location.hash.match(/show-testnets/u)) { + this.showTestNetworksRef.current.scrollIntoView({ behavior: 'smooth' }); + this.showTestNetworksRef.current.focus(); + } + } + renderMobileSync() { const { t } = this.context; const { history } = this.props; @@ -234,6 +243,7 @@ export default class AdvancedTab extends PureComponent { return (