1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

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

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

* Focusing element
This commit is contained in:
ryanml 2021-11-15 17:00:23 -07:00 committed by GitHub
parent 05fae3fa1e
commit f7c6b3228b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 1 deletions

View File

@ -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')}

View File

@ -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"
>