Scroll to "show test networks" setting from network dropdown link (#12711)

* Scroll to "show test networks" setting from network dropdown link

* Focusing element
feature/default_network_editable
ryanml 3 years ago
parent c177ff31bb
commit 3ad9ab093c
  1. 2
      ui/components/app/dropdowns/network-dropdown.js
  2. 10
      ui/pages/settings/advanced-tab/advanced-tab.component.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')}

@ -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 (
<div
ref={this.showTestNetworksRef}
className="settings-page__content-row"
data-testid="advanced-setting-show-testnet-conversion"
>

Loading…
Cancel
Save