PreTeXtBook / pretext

PreTeXt: an authoring and publishing system for scholarly documents
https://pretextbook.org
Other
254 stars 202 forks source link

Modify ToC scroll so it doesn't change tab location #2158

Open ascholerChemeketa opened 2 weeks ago

ascholerChemeketa commented 2 weeks ago

While playing with a screen reader, I figured out that the js library function scrollIntoView sets the target item as the current location for tab purposes. Thus when the ToC has to scroll to reveal an item, that item becomes the current tab stop. If the user hits tab they are already deep in the menu instead of starting from the top of the page and immediately hitting the skip link.

This modifies the ToC scroll code to not rely on that library function

rbeezer commented 2 weeks ago

I think the undesirable behavior is not universal. With Firefox I get the "Skip to Main Content" when expected, while on Chrome I do not.

Sample Article, Section 19 has a cross-reference to Appendix B. Following that causes a scroll of the ToC. In Firefox a Tab produces the skip-link. In Chrome it does not. Doesnn't mean we shouldn't fix this so Chrome works better.

Question: I'm not quite following the empty possibletocentries and the comments about subsection. Do you mean subdivision? The first is a specific element/division, the second is the generic situation of nested divisions. We can make a ToC to different depths and we can chunk the HTML to different granularities. So I don't see a subsection as special/distinctive.

If you edit this, there is a comment where tab needs a space after it. Thanks for fixing up this accessibility FUBAR.

ascholerChemeketa commented 2 weeks ago

@rbeezer Will augment the comment on the subsection. I need to go back and double-check my recollection of what that is handling.

Converting to a draft until that is done.

ascholerChemeketa commented 1 week ago

Rebuilt that function to clarify what I believe to be the original intent of that logic.

Tested against ToC's from depth 2-5 and it appears to work correctly for all.