Closed daun closed 1 year ago
Since a11y plugin is optional, the focus flag should be optional, as well. So a default value of false
sounds good to me!
@hirasso If I'm correct, the current behavior of a11y + fragment plugins is to move the focus to the main
element, even after fragment visits. A default value of false
would mean not moving focus, so a breaking change.
Ah! Right. What would you prefer?
An optional focus
key with a default of null
sounds good. The current behaviour seems to me like a good default solution, i.e. focus the main
element as configured by the a11y plugin. That's already a better experience for keyboard users than traditional MPAs that return focus to the top of the document on each navigation — here we're already skipping the header and jumping right to the content.
Depending on the markup of your fragments, this could well be enough, assuming the new fragment is a main
tag and comes first in the document. For other cases like filter UIs, specifically setting or disabling a new focus
option on the fragment rules would be a great way for fine-tuning this.
Great, let's go with a default of undefined
then, just like with the rule option for name
!
Describe the problem
main
element on navigationmain
elementDescribe the proposed solution
focus
option to fragment rules that is passed into the newvisit.a11y.focus
option, if presentfalse
here by default? Or better to make people be explicit?How important is this feature to you?