Add autopermalink toggle feature for HTML rendering#2816
Conversation
|
Note: I have a sample implementation of the feature in the examples/minimal book hosted here: https://brichwin.pages.iu.edu/min/minimal.html |
|
Thanks, @brichwin. I would be annoyed stopping and hearing all those permalinks! So it would be good to have more control over them. We have been talking about a general user preferences/readability menu (and had a trial one once a while back). Maybe this can help move that forward. Feels like that is where it belongs. |
|
Some thoughts when first seeing this idea:
1) The default should be that permalinks are there. I can explain my
reasoning, but please think about it.
2) Having the "enable/disable" link in the navbar is not really
that helpful to a reader who cannot see, or who has to use the
keyboard to navigate there.
3) A non-sighted/keyboard navigating reader is probably going to
use the "skip to main content" link. Perhaps following that link
turns off the permalinks?
4) This would be a great addition to a user preferences menu,
but maybe this is worth implementing now, and then later it moves
into the preferences menu (which will occupy the space where this
is temporarily located).
…On Thu, 2 Apr 2026, Rob Beezer wrote:
[1881714?s=20&v=4] rbeezer left a comment (PreTeXtBook/pretext#2816)
Thanks, @brichwin. I would be annoyed stopping and hearing all those permalinks! So it would be good to have more control over them.
We have been talking about a general user preferences/readability menu (and had a trial one once a while back). Maybe this can help move that forward.
Feels like that is where it belongs.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to thisthread.[AABTULCA6YJSXDZUBC5GO7T4T36MTBFCNFSM6AAAAACXLGBHRWWGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTXZGZZU5JTSMVQXG33OVJZXKYTTMNZGSY
TFMQ.gif] Message ID: ***@***.***>
|
The student screen-reader users I've worked with don't use the skip to content links on sites. They mainly use headings to get to the main content by pressing the 'H' quick nav key till they get there. Also, you really don't want simple navigation of a site to change user settings. It wouldn't be very transparent. And they might actually want to use the permalink feature. We have several instructors that use screen-readers... |
|
I don't want anybody to think this PR has been orphaned. But I'm not sure where we are on it? I asked @oscarlevin to run with it, since it seems to be mostly JS and CSS and he could guide this to completion, but we have comments from @davidfarmer that maybe have not been addressed? Anyway, not sure whose court the ball is in? And if it is mine, let me know what needs my attention. |
|
I believe this is still being held up by me. I hope to get to it soon.
Definitely not abandoned, I just need to clear my plate for a big push.
…On Mon, Jun 1, 2026, 2:09 PM Rob Beezer ***@***.***> wrote:
*rbeezer* left a comment (PreTeXtBook/pretext#2816)
<#2816 (comment)>
I don't want anybody to think this PR has been orphaned. But I'm not sure
where we are on it? I asked @oscarlevin <https://github.com/oscarlevin>
to run with it, since it seems to be mostly JS and CSS and he could guide
this to completion, but we have comments from @davidfarmer
<https://github.com/davidfarmer> that maybe have not been addressed?
Anyway, not sure whose court the ball is in? And if it is mine, let me know
what needs my attention.
—
Reply to this email directly, view it on GitHub
<#2816?email_source=notifications&email_token=ABRUBFA3Y7CRSQ6L4GAC6G345XIIFA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTINJZGU3DMMBWGEY2M4TFMFZW63VHNVSW45DJN5XKKZLWMVXHJLDGN5XXIZLSL5RWY2LDNM#issuecomment-4595660611>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABRUBFGUSUMVGY7GII26MS345XIIFAVCNFSM6AAAAACXLGBHRWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHM2DKOJVGY3DANRRGE>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
|
See in-progess (general) work on #2951. @davidfarmer said:
I agree. See discussion on #2951. |
|
Is the on by default an option that can be set by the publisher/author? For example, our faculty would prefer the permalinks off by default since students with screen readers would otherwise have to discover how to turn them off and the faculty are aware enough to turn them on when they need them. |
|
When we have a report from screen reader uses that permalinks are distracting, we should take it seriously. Even in my limited use of a screen reader for testing pages, I find they drive me nuts. I can only imagine trying to read the content and having them pop up. I wasn't aware of this (or had forgotten???) when I implemented #2951. It takes the approach of making them invisible to screen readers by default with a switch to turn them on. The thinking was much what @brichwin just mentioned - instructors will likely know/figure out how to turn them on, but students trying to read won't have to fight through them until they realize there is a setting to turn them off. I think it makes more sense as a reader setting than a book level one, and now (well, in-flight) we have a place for those. |
|
I do not want to sound insensitive, but this is a case where a valuable feature for the majority of readers should be apparent out-of-the-box. I am aware of how intrusive they are with a screen reader. Can we not toggle "screen reader visibility" somehow? Default is visible for sighted readers and "anannounced" for those with screen readers? Maybe we have two items on the new menu? |
|
s/anannounced/unannounced/ ;-) |
|
FYI - There are other users who would need them turned completely off that aren't screen reader users. For example, try accessing links using voice control in a page with a lot of content. Voice control has trouble handing pages with a lot of links. For example, try saying "Show links" on a long page with literally 100's of permalinks. I'd keep it simple. Have them on or off. I wouldn't have them simply not announced for screen reader users as normally a link with aria-hidden is still available to voice control users. Also, there are other TTS readers for the print impaired audience (sighted users with dyslexia, ESL, etc.) which don't always honor aria-hidden. |
|
Live sample of implementation as reader options: https://computerscience.chemeketa.edu/ascholer/pretext-test/reader-opts/section-fundamental-theorem.html @rbeezer "announced" is a major part of the awful part. Your average student never makes use of them and thus they have limited value for that user. And students are the vast majority of users (and of non-power users). The default out of the box should be as useful as possible. If a feature provides little value to that median user, and causes active issues, it should be opt in. @blrichwine I think part of the answer is to reimplement them as buttons or at least give them that aria-role. "Links go somewhere and buttons do something" The autopermalinks do something. That would help with the link based navigation, right? |
Probably. I'd have to go back and look at the UI chrome around the document. The document wouldn't typically have buttons, so if a student is trying to activate a link in the document, they would be asking to activate links. Having the links list not cluttered by the permalinks would be helpful. The next/previous navigation "buttons" are coded as links, so I think it would be fine. Of course, if they are off by default regardless if links or buttons then it is a non-issue. |
|
Here are two apparently conflicting good points:
Is putting |
It's tricky:
|
|
That is what 2591 does - it defaults to @brichwin - what TTS should we check against? I think making them buttons would help in that they would not count as links. Even if the tool ignored |
|
Both Voice Control in macOS and Voice Access in Windows 11 are popular. macOS Voice Control:
Windows 11 Voice Access |
|
I don't have access to a mac, but with Win11 Voice Access, and 2591 in place the items are not revealed by default with "Show numbers". When I use the reader option to "expose permalinks" and then do "Show numbers" with Voice Access, I do see the permalinks as numbered items. btw just fixed the sample at https://computerscience.chemeketa.edu/ascholer/pretext-test/reader-opts/section-fundamental-theorem.html - some of the JS was out of date. |
|
Let's make sure we are doing the right thing versus accomodating tools that are deficient. The tools can catch up. |
I had my colleague Mary Stores test reading https://computerscience.chemeketa.edu/ascholer/pretext-test/reader-opts/section-fundamental-theorem.html using the JAWS screen reader. She was able to read the main content without hearing the permalinks. Then I asked her to see if she could turn on the permalinks and use them (without telling her how). She first tried the embed control but then found the reading options and was able to successfully turn them on and then use them. |
Fabulous - thanks for the testing! |
Description
This PR adds a proof-of-concept toggle feature that allows readers to show and hide
div.autopermalinkelements in HTML output of a PreTeXt textbook.Note: I attended the Zoom PreTeXt Dropin on Thursday 2026-04-02 and discussed the autopermalink toggle. Oscar and Chrissy mentioned I should create a PR so they can see the sample implementation and be reminded to consider the feature request. It was mentioned that the actual feature if implemented would likely be implemented differently and I am totally fine with that.
Motivation
Permalink icons are always presented to screen-reader users in the current output. We received feedback from screen reader users evaluating our use of PreTeXt. They reported that repeatedly hearing "Link: Copy heading and permalink for Paragraph" while reading a textbook is both distracting and annoying. These links also present numerous tab stops to keyboard only users that may not be interested in creating permalinks.
The fix we propose is to have permalinks links enabled only when needed, then the best of both worlds can be achieved.
Enabling the Feature
For this proof-of-concept, the feature is enabled on a per book basis. In the publisher file, add
<permalink-button/>inside an<html>element:Behavior
div.autopermalinkelements are hidden by default on page loadlink)— clicking will show permalinkslink_off) — clicking will hide permalinksAccessibility
aria-labelattribute that updates to describe the action the button will perform, consistent with the pattern used by other PreTeXt navbar controlsdisplay: noneremoves hidden permalinks from both the visual and accessibility treeOther notes
en-US.xml. Other locales have not been provided. These will fallback to English automatically until translators add their own entries.ptx_default_settingsJS object is how this code is passing the XSL settings to the new JS. Isptx_default_settingsthe right pattern for passing XSL settings to the JS space, or is there a preferred alternative?aria-pressedattribute on the button, but feedback from a JAWS screen reader was that having both the changing button name and the aria-pressed state was confusing. Thearia-pressedattribute was removed the JAWS user reported this was best.Description of changes
xsl/publisher-variables.xsl:$b-has-permalink-buttonvariable reading$publication/html/permalink-buttonxsl/pretext-html.xsl:permalink-toggle-buttonnamed templateprimary-navigation-other-controlsptx_default_settingsscript blockxsl/localizations/en-US.xmlpermalink-enableandpermalink-disablelocalization string IDsjs/pretext_add_on.jsinitPermalinkToggle()andsetPermalinkVisibility()data-attributes