diff --git a/docs/router/basics.md b/docs/router/basics.md index 1576c1be..93769442 100644 --- a/docs/router/basics.md +++ b/docs/router/basics.md @@ -94,7 +94,7 @@ export default Blits.Component('Poster', { }) ``` -Whenever you navigate to a new page, the URL hash will automatically be updated. Unless specified otherwise, navigating to a new page, will add that route to the history stack. The `back` input action is automatically wired up to navigate back down the history stack. +Whenever you navigate to a new page, the URL hash will automatically be updated. Unless specified otherwise, navigating to a new page, will add that route to the history stack. The `back` input action is automatically wired up to navigate back down the history stack. (If you want to disable this automatic navigation, you can pass `navigateHistory="false"` as a prop to the RouterView.) By default, every time you navigate to a new route, the application focus will be automatically passed to the newly loaded page. If you instead want to maintain the current focus (for example in a widget that sits above your RouterView), you can use `passFocus: false` as part of the router options. diff --git a/src/components/RouterView.js b/src/components/RouterView.js index f6a3d97a..65d9586f 100644 --- a/src/components/RouterView.js +++ b/src/components/RouterView.js @@ -50,10 +50,10 @@ export default () => } }, }, + props: [{ key: 'navigateHistory', default: true }], input: { back(e) { - const navigating = Router.back.call(this) - if (navigating === false) { + if (!this.navigateHistory || !Router.back.call(this)) { this.parent.$focus(e) } },