folks - is there anything against doing the following:

Using router, after route change & a component being called, using said component's mounted lifecycle method to the 1st sensible element within it, after a delay of course?

cc @heydon @yatil @scottohara

@marcus @yatil @scottohara This sounds like a good idea. But for maintenance's sake, you should try to manage focus at the router level, rather than per component.

@marcus @yatil @scottohara I think you can just add a watcher to the high level component that contains all your routes, like so:

watch:{
$route (to, from){
// focus stuff here
}
}

Follow

@heydon I solved it this way: codepen.io/marcus/pen/ce80f4c4

-> A watcher in the high level component expecting a certain ref in the component. Then putting focus on the element with said ref.

Sign in to participate in the conversation
Mastodon

Follow friends and discover new ones. Publish anything you want: links, pictures, text, video. This server is run by the main developers of the Mastodon project. Everyone is welcome as long as you follow our code of conduct!