The proposed change makes system messages easier to locate and revisit by adding one named landmark. Existing message roles and announcement mechanisms are retained.
Three different things
| Concept | What it does | In !17968 |
|---|---|---|
| Landmark navigation | Lets a person jump to a named area with the landmarks rotor or shortcut. | Added: one region named “System messages”. |
| Live-region semantics | Tells assistive technology that a message appeared. role="status" is polite; role="alert" is assertive. |
Unchanged: status, warning and error keep their roles. |
| Explicit announcements | Drupal.announce() writes a message to a separate live region. Drupal uses it for JavaScript messages. |
Unchanged: the existing calls stay; the landmark does not call it. |
Messages were already reachable through reading order and the visually hidden headings. The landmark adds a more direct route; it does not make the messages newly audible, and it does not replace headings.
Examples
Before
Current markup: three live message groups in an unnamed container.
After
The same messages inside
role="region"+aria-label="System messages", as in the merge request.Native section
A named
sectionwith equivalent landmark semantics. An alternative implementation, not what !17968 proposes.JavaScript messages
One persistent container whose landmark attributes are added and removed as messages come and go.
Server and JavaScript
Server-rendered messages keep their landmark when JavaScript messages are cleared; a custom name is not overwritten.
Announcement experiment
Not part of !17968: a single polite “messages are available” announcement, triggered by a button.
The messages look the same
Before: unnamed container
After: region “System messages”
Visual replicas with no live roles. The real examples are the Before and After pages.
The only HTML change
Before, from core/modules/system/templates/status-messages.html.twig:
<div data-drupal-messages>
<div role="status" aria-label="Status message">…</div>
<div role="alert" aria-label="Warning message">…</div>
<div role="alert" aria-label="Error message">…</div>
</div>
After, with the added attributes highlighted:
<div data-drupal-messages role="region" aria-label="System messages">
<div role="status" aria-label="Status message">…</div>
<div role="alert" aria-label="Warning message">…</div>
<div role="alert" aria-label="Error message">…</div>
</div>
The native alternative, which is not the proposed implementation:
<section aria-label="System messages">
<div role="status" aria-label="Status message">…</div>
<div role="alert" aria-label="Warning message">…</div>
<div role="alert" aria-label="Error message">…</div>
</section>
No aria-live, no new role on the message groups, no heading change and no JavaScript are added for server-rendered messages.
Accessibility trees
Before
main
├─ status "Status message"
├─ alert "Warning message"
└─ alert "Error message"
After
main
└─ region "System messages"
├─ status "Status message"
├─ alert "Warning message"
└─ alert "Error message"
Landmark navigation
Before, the landmarks list has the page landmarks (banner, navigation, main, content information) but no message area. After, it also has “System messages”. Choosing it moves to the region. The heading order and reading order do not change, so a person who navigates by heading or by reading can still do that.
Announcements: what changes, and what does not
- Server-rendered messages are already in the HTML when the page loads. Browsers and screen readers do not consistently announce live regions that are already populated on load; behaviour varies. The merge request does not change that.
- A live region inserted with JavaScript already populated is also not guaranteed to be announced; support varies. The outer named region is not a live region, so it adds no announcement of its own.
- Message roles are preserved. Status stays
role="status"; warning and error stayrole="alert". The merge request also keeps the existingDrupal.announce()calls for JavaScript messages. - The containment fix can affect announcements. The merge request stops a JavaScript message from being inserted inside an existing
alertorstatusgroup. That can change what some browser and assistive-technology combinations announce. In the Lab’s recorded VoiceOver run, the unsolicited announcement after activation was the same combined three-message string Before and After. See SCREENREADER.md. - This demonstration does not implement
Drupal.announce(). It shows the markup and the landmark lifecycle only. It does not simulate speech, and it does not claim that the same announcement happens in every screen reader.
Test it with a screen reader
VoiceOver on macOS
- Open Before, press VO+U and choose Landmarks. There is no “System messages” entry. The messages are still in reading order and under their headings.
- Open After and repeat. “System messages” is listed; choosing it moves to the region.
- Open Server and JavaScript and clear the JavaScript messages. The server messages and the landmark remain.
- VoiceOver may or may not announce the messages when a page opens. That is the existing live-region behaviour, not something the landmark adds.
NVDA on Windows
- Open Before and press D (next landmark) or NVDA+F7 → Landmarks. No “System messages” landmark.
- Open After and press D. “System messages” is announced as a region; Shift+D moves back.
- Open JavaScript messages, add a message and use D. Remove the last message; the landmark is gone.
These are instructions, not automated results. The Lab recorded scripted VoiceOver evidence, not a person using the rotor: see SCREENREADER.md.
What this demonstration is not
- It is not Drupal. It does not load Drupal,
Drupal.Message, a theme or the merge request’s code. - The CSS is a stand-in for Drupal’s message styling. The visible type label (“Status”, “Warning”, “Error”) is added so type is not conveyed by colour alone; core uses a visually hidden heading and theme styling.
- It does not show dismissal, AJAX responses, BigPipe or multiple default containers. The mixed page covers the server/JavaScript ownership distinction in a simplified form.
- It is not a conformance claim and it does not replace a person’s screen-reader pass. The announcement experiment is a proposal, not part of the merge request.