etherpad-lite/src/static/js
John McLear 924059257d
fix(a11y): name role=toolbar regions, hide linemetricsdiv from AT (#7255) (#7777)
* fix(a11y): name role=toolbar regions, hide linemetricsdiv from AT (#7255)

Two regressions called out in the 2026-05-16 follow-up on #7255, after the
firefox accessibility inspector flagged them:

(1) The "Ether X" announcement between the editor and chat button was the
outer ace iframe (titled "Ether") plus a single 'x' text leaf the renderer
appends to outerdocbody for line-height measurement (linemetricsdiv in
ace.ts). Add aria-hidden=true on creation so AT skips the measurement node
entirely. Same approach we used for sidediv in PR #7758.

(2) The two formatting/actions <ul role="toolbar"> regions and the
history-mode role=toolbar div had no accessible name. Lighthouse + the
firefox a11y panel both flagged this. Putting data-l10n-id directly on
the <ul> would either destroy its <li> children (textContent branch) or
not populate aria-label (the html10n auto-aria-label code path skips
non-form-control elements), and a hidden <span> child inside the <ul>
would be invalid HTML. Solution: three visually-hidden <span> labels
sitting just before #editbar, each carrying data-l10n-id for translation,
referenced from the toolbars via aria-labelledby. Apply the same treatment
to .show-more-icon-btn, whose aria-label was previously hardcoded English
(no data-l10n-id, so untranslated).

Adds Playwright assertions for linemetricsdiv aria-hidden and the resolved
accessible-name text of each toolbar. Updates the existing show-more test
to expect aria-labelledby (it previously asserted hardcoded English
aria-label).

Refs #7255

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* fix(a11y): reuse translated history-controls label key (Qodo PR review)

Qodo flagged: adding `aria-labelledby="editbar-history-label"` on
#history-controls overrode the `aria-label` that pad_mode.ts sets from
`pad.historyMode.controlsLabel`. That key is already translated in
multiple locales (en/de/nl/...); the new `pad.editor.toolbar.history`
key was English-only, so non-English users would regress from a
localized history-toolbar name to the English fallback.

Point the hidden label span at the existing translated key instead of
minting a new one, drop the new key from en.json, and update the
Playwright expectation to match the translated string ("Pad history
controls"). The aria-label that pad_mode.ts still writes to
#history-controls is now redundant (aria-labelledby wins) but harmless,
and leaving it preserves the runtime relocalization path.

Refs ether/etherpad#7777

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* fix(a11y): mark toolbar li/a wrappers presentational (Lighthouse, #7255)

Lighthouse's axe-core `listitem` rule fires on every toolbar button
because role="toolbar" on the <ul> overrides its implicit role="list",
leaving the <li> children "orphaned" by axe's heuristic. Murphy's
2026-05-16 follow-up on #7255 attached the Chrome DevTools Lighthouse
panel screenshot of this exact failure.

Marking the <li>+<a> wrappers role="presentation" tells axe-core they
are layout scaffolding for the toolbar role, while the inner <button>
keeps its semantics for AT. Same treatment for SelectButton's <li>
wrapper. The Separator's <li> also gets aria-hidden=true so AT does
not announce an empty list item between toolbar buttons.

CSS and JS selectors that still target `.toolbar ul li` continue to
work — role="presentation" only affects the accessibility tree, not
the DOM tree. No visual or behavioral change for sighted users.

Adds a Playwright spec that walks every rendered toolbar <li>/<a>
and asserts role="presentation" so future toolbar.ts tweaks can't
silently re-introduce the Lighthouse failure.

Refs ether/etherpad#7255

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* fix(a11y): label #online_count for AT (#7255 - "number next to the user icon")

Murphy's 2026-05-16 follow-up cut off mid-bullet ("It's not clear what the
number next to the …"). Best guess: the user-count badge in the showusers
toolbar button. Currently it exposes a bare digit to AT — "5" with no
context — because the visible badge text is also the entire accessible
content.

Append a localized aria-label generated from a new pad.userlist.onlineCount
key (plural macro for one / other) whenever the count updates, so AT
announces "5 connected users" instead of the bare digit. Add role=status
and aria-live=polite so the count change is announced inline without
forcing the user to refocus the button.

Visible badge digit unchanged. html10n.get is null-safe (falls back to
an English template so AT never gets back "undefined" before the locale
bundle has loaded).

Adds a Playwright spec verifying role/aria-live and that the aria-label
contains "connected user".

Refs ether/etherpad#7255

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* fix(a11y): tighten #online_count + plugin-emitted toolbar <li>s (#7255)

Two small follow-ups on top of the toolbar/online-count work:

(1) #online_count had no accessible label on solo-author pads.
updateNumberOfOnlineUsers — which writes the localized aria-label —
only fires on userJoin/userLeave/status change, never on initial
single-author load. Call it at the end of init() so the badge ships
with its label on first paint. Also bind html10n's 'localized' event
so non-English users get the translated label after the locale bundle
arrives (matches the keyboard-hint / history-toolbar pattern).
Harden the Playwright spec to use polling toHaveAttribute instead of
one-shot getAttribute.

(2) Sweep role="presentation" onto plugin-emitted toolbar <li>s in
pad_editbar.ts init(). Core's toolbar.ts emits its <li>s with the role
already, but plugins (ep_headings2, ep_align, ep_font_*, ep_print, ...)
ship their own editbarButtons.ejs templates that emit <li> directly,
so Lighthouse's listitem rule kept firing on the "with plugins" test
runs. Runtime sweep covers anything in the editbar at init time, no
plugin coordination needed.

Refs ether/etherpad#7255

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-16 13:08:33 +01:00
..
pluginfw chore: removed axios (#7685) 2026-05-06 22:06:04 +02:00
types security: allow integrator sessionID cookie to be HttpOnly (#7045) (#7755) 2026-05-15 19:44:55 +01:00
vendors a11y: localize aria-label on form-control elements (<select>, <input>, <textarea>) (#7713) 2026-05-10 12:23:33 +01:00
ace.ts fix(a11y): name role=toolbar regions, hide linemetricsdiv from AT (#7255) (#7777) 2026-05-16 13:08:33 +01:00
ace2_common.ts Moved to ts (#6593) 2024-08-17 20:14:36 +02:00
ace2_inner.ts fix(colors): pick WCAG-higher-contrast text for author colors (#7565) 2026-05-03 12:56:30 +08:00
AttributeManager.ts Feat/changeset ts (#6594) 2024-08-18 12:14:24 +02:00
AttributeMap.ts Moved to ts (#6593) 2024-08-17 20:14:36 +02:00
AttributePool.ts Moved to ts (#6593) 2024-08-17 20:14:36 +02:00
attributes.ts Moved to ts (#6593) 2024-08-17 20:14:36 +02:00
basic_error_handler.ts Moved to ts (#6593) 2024-08-17 20:14:36 +02:00
broadcast.ts feat(pad): scrub history in-place on the pad URL (#7659) (#7710) 2026-05-10 16:21:56 +01:00
broadcast_revisions.ts Moved to ts (#6593) 2024-08-17 20:14:36 +02:00
broadcast_slider.ts feat: add timeslider playback speed setting (#7541) 2026-04-19 09:08:37 +01:00
Builder.ts Feat/changeset ts (#6594) 2024-08-18 12:14:24 +02:00
caretPosition.ts Feat/bundle js (#6511) 2024-07-18 08:51:30 +02:00
Changeset.ts build(deps): bump jose from 5.10.0 to 6.0.12 (#7049) 2025-08-04 19:21:59 +02:00
changesettracker.ts Fixed document not accessible in iframe (#6642) 2024-09-09 11:26:12 +02:00
ChangesetUtils.ts Feat/changeset ts (#6594) 2024-08-18 12:14:24 +02:00
chat.ts feat(pad): scrub history in-place on the pad URL (#7659) (#7710) 2026-05-10 16:21:56 +01:00
ChatMessage.ts Moved to ts (#6593) 2024-08-17 20:14:36 +02:00
collab_client.ts fix: warn when a pending edit is not accepted (#7540) 2026-04-19 11:11:07 +01:00
colorutils.ts fix(colors): pick WCAG-higher-contrast text for author colors (#7565) 2026-05-03 12:56:30 +08:00
contentcollector.ts fix(editor): preserve U+00A0 non-breaking space (#3037) (#7585) 2026-04-23 08:57:30 +01:00
cssmanager.ts Moved to ts (#6593) 2024-08-17 20:14:36 +02:00
domline.ts fix(editor): preserve U+00A0 non-breaking space (#3037) (#7585) 2026-04-23 08:57:30 +01:00
index.ts Fixed index html page 2024-07-23 18:14:49 +02:00
l10n.ts feat: make cookie names configurable with prefix setting (#7450) 2026-04-05 01:58:29 +01:00
linestylefilter.ts Feat/changeset ts (#6594) 2024-08-18 12:14:24 +02:00
MergingOpAssembler.ts Feat/changeset ts (#6594) 2024-08-18 12:14:24 +02:00
Op.ts Feat/changeset ts (#6594) 2024-08-18 12:14:24 +02:00
OpAssembler.ts Feat/changeset ts (#6594) 2024-08-18 12:14:24 +02:00
OpIter.ts Feat/changeset ts (#6594) 2024-08-18 12:14:24 +02:00
pad.ts security: allow integrator sessionID cookie to be HttpOnly (#7045) (#7755) 2026-05-15 19:44:55 +01:00
pad_automatic_reconnect.ts Moved to ts (#6593) 2024-08-17 20:14:36 +02:00
pad_connectionstatus.ts Moved to ts (#6593) 2024-08-17 20:14:36 +02:00
pad_cookie.ts feat: make cookie names configurable with prefix setting (#7450) 2026-04-05 01:58:29 +01:00
pad_editbar.ts fix(a11y): name role=toolbar regions, hide linemetricsdiv from AT (#7255) (#7777) 2026-05-16 13:08:33 +01:00
pad_editor.ts feat(colors): add padOptions.fadeInactiveAuthorColors with toolbar UI (#7554) 2026-05-03 04:01:13 +08:00
pad_impexp.ts feat(export): native DOCX export via html-to-docx (opt-in) (#7568) 2026-05-08 18:33:50 +01:00
pad_modals.ts Moved to ts (#6593) 2024-08-17 20:14:36 +02:00
pad_mode.ts feat(pad): scrub history in-place on the pad URL (#7659) (#7710) 2026-05-10 16:21:56 +01:00
pad_savedrevs.ts Moved to ts (#6593) 2024-08-17 20:14:36 +02:00
pad_userlist.ts fix(a11y): name role=toolbar regions, hide linemetricsdiv from AT (#7255) (#7777) 2026-05-16 13:08:33 +01:00
pad_utils.ts fix: RTL URL parameter rtl=false now correctly disables RTL mode (#7464) 2026-04-06 11:22:57 +01:00
pad_version_badge.ts feat(updater): tier 1 — notify admin and pad users of available updates (#7601) 2026-05-01 20:02:12 +08:00
privacy_banner.ts feat(gdpr): configurable privacy banner (PR4 of #6701) (#7549) 2026-05-03 13:59:38 +08:00
rjquery.ts Moved to ts (#6593) 2024-08-17 20:14:36 +02:00
scroll.ts feat: continued with pad link functionality 2025-08-01 21:42:05 +02:00
security.ts Moved to ts (#6593) 2024-08-17 20:14:36 +02:00
skin_toolbar_colors.ts fix(7606): sync theme-color meta with client-side dark-mode switch (#7690) 2026-05-07 10:43:29 +01:00
skin_variants.ts feat(pad): scrub history in-place on the pad URL (#7659) (#7710) 2026-05-10 16:21:56 +01:00
skiplist.ts Moved to ts (#6593) 2024-08-17 20:14:36 +02:00
SmartOpAssembler.ts Feat/changeset ts (#6594) 2024-08-18 12:14:24 +02:00
socketio.ts fix(socket.io): readd long polling 2025-03-13 14:32:00 +01:00
StringAssembler.ts Feat/changeset ts (#6594) 2024-08-18 12:14:24 +02:00
StringIterator.ts Feat/changeset ts (#6594) 2024-08-18 12:14:24 +02:00
TextLinesMutator.ts Feat/changeset ts (#6594) 2024-08-18 12:14:24 +02:00
timeslider.ts security: allow integrator sessionID cookie to be HttpOnly (#7045) (#7755) 2026-05-15 19:44:55 +01:00
underscore.ts Moved to ts (#6593) 2024-08-17 20:14:36 +02:00
undomodule.ts fix: allow undo of clear authorship colors without disconnect (#7430) 2026-04-19 09:09:03 +01:00
welcome.ts feat(gdpr): HttpOnly author-token cookie (PR3 of #6701) (#7548) 2026-05-03 05:56:56 +01:00