Onboarding: Scroll to top when navigating between pages (https://github.com/woocommerce/woocommerce-admin/pull/3122)
* Scroll to top when navigating between tasks * Scroll to top when navigating between steps
This commit is contained in:
parent
af10516b8f
commit
9d04b15c7a
|
@ -71,6 +71,15 @@ class ProfileWizard extends Component {
|
||||||
this.goToNextStep = this.goToNextStep.bind( this );
|
this.goToNextStep = this.goToNextStep.bind( this );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
componentDidUpdate( prevProps ) {
|
||||||
|
const { step: prevStep } = prevProps.query;
|
||||||
|
const { step } = this.props.query;
|
||||||
|
|
||||||
|
if ( prevStep !== step ) {
|
||||||
|
window.document.documentElement.scrollTop = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
document.documentElement.classList.remove( 'wp-toolbar' );
|
document.documentElement.classList.remove( 'wp-toolbar' );
|
||||||
document.body.classList.add( 'woocommerce-onboarding' );
|
document.body.classList.add( 'woocommerce-onboarding' );
|
||||||
|
|
|
@ -40,10 +40,11 @@ class TaskDashboard extends Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidUpdate( prevProps ) {
|
componentDidUpdate( prevProps ) {
|
||||||
const { task } = this.props.query;
|
|
||||||
const { task: prevTask } = prevProps.query;
|
const { task: prevTask } = prevProps.query;
|
||||||
|
const { task } = this.props.query;
|
||||||
|
|
||||||
if ( prevTask !== task ) {
|
if ( prevTask !== task ) {
|
||||||
|
window.document.documentElement.scrollTop = 0;
|
||||||
this.recordTaskView();
|
this.recordTaskView();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue