Problem/Motivation
Normally, when a screenreader user follows a link, a full page load happens, and the title of the new page is announced. (There may be some other incidental sounds, depending on the particular screenreader used.)
With RefreshLess, following a link does not cause a full page load, so the new page title is not announced, and the it's not obvious a new page has loaded.
Proposed resolution
This is the sort of thing Drupal.announce() Javascript API was created for, so lets use it.
- Announce that a new page has loaded (or maybe finer grained, announce what regions have changed?)
- Announce the name of the page.
Remaining tasks
User interface changes
Improvements to screenreader experience.
API changes
Unknown.
Data model changes
None expected.
Comments
Comment #2
andrewmacpherson commentedComment #3
wim leers+1, great point! :) I didn't even think about this. Thanks for bringing this up!
Comment #4
andrewmacpherson commentedUpdating summary, point to correct issue about <head> element updates.
Comment #5
andrewmacpherson commentedComment #6
mgiffordComment #7
wim leersHow do GitHub and BaseCamp deal with this? GitHub uses PJAX and BaseCamp uses a different implementation of TurboLinks.
If y could look into that and share your findings, that would be very valuable :)
Related: http://stackoverflow.com/questions/28282264/optimise-turbolinks-for-scre...
Comment #8
andrewmacpherson commentedFirst stab at a patch. This announces:
1) A new page has loaded
2) The first H1 found on the page
To test this, I generated a bunch of nodes and menu-links with devel_generate. It works fine as long as there is a H1. (It doesn't work when arriving at the homepage, where the H1 exists but is empty, meh. EDIT: this won't be an issue once the new <title> is available.)
The announcement is queued after the URL has been updated.
Once #2692317: Make everything in <head> update: <title>, <meta> tags, etc. is done, we can use the <title> element.
Comment #9
andrewmacpherson commented@Wim, to clarify, is the intent of RefreshLess to provide the same eventual HTML DOM as you would have got by visiting that URL in the first place, and retrieved the page all in one go?
If so, I think we only need to announce the page title you would have got, prepended with a simple "new page" indication in place of any indication the screenreader normally makes for a new page. (ChromeVox has a special sound for a new page load). There's no need to be say anything more than that, I think.
Do you imagine any scenario with RefreshLess where this is not the case?
I'll have a play around with any other partial page load implementations I can find in the wild.
Comment #10
wim leersYes, that is the intent!
Comment #11
andrewmacpherson commentedWe need to include drupal.announce as a dependency of the refreshless library.
Comment #12
mgiffordComment #13
wim leersI'm working on #2692317: Make everything in <head> update: <title>, <meta> tags, etc., that will allow this to be solved once and for all, rather than getting this interim fix in first.
Comment #14
wim leersComment #15
wim leersNote that the patch there is already working, I'm just cleaning it up.
Comment #16
andrewmacpherson commented#2692317: Make everything in <head> update: <title>, <meta> tags, etc. is fixed, I'll update this soon.
Comment #17
wim leersNote that eventually this should probably happen in response to some event. But for now it's fine to hardcode this in the appropriate place.
Comment #18
wim leersComment #19
wim leersI think this is ready. Giving credit to everybody involved.
Comment #21
wim leersComment #22
andrewmacpherson commentedRe: comment #7 (for completeness sake)...
I tried out a bunch of pjax/turbolinks type sites. I didn't manage to find any that made any accommodation for users with screen-readers.
The StackOverflow answer is in favour of an ARIA live region. It uses
jQuery.a11yfy.assertiveAnnounce(document.title), which is really the same approach as our use ofDrupal.announce(title, 'assertive');.The only thing we've done differently is that we added an explicit "new page loaded" phrase, to accommodate some screenreaders which normally use a sound effect on new page loads. This was a judgement call on my part, and hopefully isn't intrusive.
Comment #23
wim leers#22: Excellent! Many thanks for your research & analysis :)