Follow

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 I could pretend I understand a word of what you wrote :-D

General advice: When a page is loaded with Javascript, make sure to reflect the change in the <title> and set the focus to the heading of that section so that the user knows something has changed. You could look into having an aria live region to signal that it has loaded in case the load could take a longer time.

/cc @heydon @scottohara

@yatil @heydon @scottohara Sorry, the question was too -specific. I know too few people in intersection Vue and . But you are describing with other words exactly what I'm trying to achieve :D

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

@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

Server run by the main developers of the project 🐘 It is not focused on any particular niche interest - everyone is welcome as long as you follow our code of conduct!