File tree Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Original file line number Diff line number Diff line change 1818import Component from '../component.js'
1919import Router from '../router/router.js'
2020import symbols from '../lib/symbols.js'
21+ import Focus from '../focus.js'
2122
2223let hashchangeHandler = null
2324
@@ -44,7 +45,9 @@ export default () =>
4445 window . removeEventListener ( 'hashchange' , hashchangeHandler , false )
4546 } ,
4647 focus ( ) {
47- this . activeView && this . activeView . $focus ( )
48+ if ( this . activeView && Focus . get ( ) === this ) {
49+ this . activeView . $focus ( )
50+ }
4851 } ,
4952 } ,
5053 input : {
Original file line number Diff line number Diff line change @@ -337,6 +337,9 @@ export const navigate = async function () {
337337 // keep reference to the previous focus for storing in cache
338338 previousFocus = Focus . get ( )
339339
340+ const children = this [ symbols . children ]
341+ this . activeView = children [ children . length - 1 ]
342+
340343 // set focus to the view that we're routing to
341344 focus ? focus . $focus ( ) : /** @type {BlitsComponent } */ ( view ) . $focus ( )
342345
@@ -380,8 +383,6 @@ export const navigate = async function () {
380383 await setOrAnimate ( holder , route . transition . in , shouldAnimate )
381384 }
382385 }
383- const children = this [ symbols . children ]
384- this . activeView = children [ children . length - 1 ]
385386 } else {
386387 Log . error ( `Route ${ hash } not found` )
387388 const routerHooks = this . parent [ symbols . routerHooks ]
You can’t perform that action at this time.
0 commit comments