Navigation API router: do not reset focus on navigation#152
Conversation
rschristian
left a comment
There was a problem hiding this comment.
Looks good to me, thanks!
Unfortunately won't be able to release for a bit as I'm on vacation, will do when I get back
Actually, I want to think about this more. I can also imagine a header search bar which navigates to a new page, at which point, maintaining focus by default would be less than ideal. Hmm
|
Is there a way to prevent focus change with the main router implementation at the moment? I understand it would be better to leave the user the choice of the focus behavior. |
|
Sorry, do you mean "allow focus change" (or blur)? To my knowledge, the main router will not blur, though I don't think we have any tests guaranteeing behavior. It's also a bit moot as the Navigation API is the future, what the previous iteration does shouldn't constrain us as this is opt-in yet. I believe the current solution here is still fine, users can manually blur if they need to much easier than re-focusing, but want to think on it longer. Navigation API defaults to MPA-like behavior intentionally, maybe it'll be better to match yet. Not sure. |
rschristian
left a comment
There was a problem hiding this comment.
Thought on it more and I think this will indeed be the better path.
Sorry for the switch up & delay! Just had to think things through a bit.
Fixes #151
The fix have been tested in my own projects.
I have added a test case which verifies if focus is preserved.