Skip to content

Web: an app built on Rune can pass an independent WCAG 2.1 A and AA audit #109

Open

Description

@SuperManfred

Filed as an issue, as asked on #59.

Public-facing services in regulated sectors have to be tested against WCAG 2.1 A and AA, and to show continuous support across devices, browsers and platforms. We want to build those services on Rune.

PLAN.md commits to "AccessKit, and the same tree is the agent inspector's tree", and the README lists the web as a target. This asks for that design on the web.

Ask: an app built on Rune and Rune Kit, in the web build, can pass an independent WCAG 2.1 A and AA audit, on desktop and phone browsers, with no criterion failing because of Rune.

Today (781e2b6, Chromium and WebKit, a plain Rune Kit form)

  • All text fields share one hidden textarea named "Text input", so "Email address" never reaches the field. The password field is named "Password input".
  • Fields can't declare input purpose. The password field hard-codes autocomplete="off".
  • Setting a 13-character value on a password holding 8 typed characters, as autofill does, leaves 21 characters in the app.
  • A checkbox is exposed as a plain button, with no checked state.
  • When a button or checkbox has focus, DOM focus sits on the unnamed canvas.
  • role("main") gives no landmark, role("status") gives no live region, and invalid(true) gives no aria-invalid.
  • web-build.sh writes maximum-scale=1,user-scalable=no, which blocks pinch zoom.
  • At 195 px wide (a 390 px phone at 200%), fields run off the right edge with no way to scroll to them.
  • A user stylesheet for text spacing changes no pixels.
  • Kit neutral: border_weak is 1.87:1 dark and 1.14:1 light; light text_faint is 3.00:1 and text_accent is 3.99:1.
  • Without WebGPU the page shows only an error message, with no form and no accessibility tree.
  • Enter does nothing on a focused Button; Space and click work.

Limits of this run: autofill was simulated by setting the field's value, nothing was spoken (we read the browser's accessibility tree), and contrast is calculated from the palette.

Requirements

Criterion Level Rune or Kit must
1.1.1 A Hide canvas drawing from assistive technology; give symbols and icon buttons text names
1.3.1, 1.3.2 A Expose headings, labels, groups, tables and states, in reading order
1.4.1 A Never signal errors or links by colour alone (Kit)
2.1.1, 2.1.2 A Make every control work by keyboard, with no trap
2.2.1 A Set no time limit a person can't adjust (Kit)
2.4.1, 2.4.2, 2.4.3 A Provide landmarks, page title and logical focus order
2.5.1, 2.5.2, 2.5.3 A Offer single-pointer alternatives; fire a press on release; include the visible text in the name
3.1.1 A Let the page language be set
3.2.1, 3.2.2 A Change no context on focus or input alone
3.3.1, 3.3.2 A Tie errors and labels to their field and expose them
4.1.1, 4.1.2 A Use unique IDs; expose name, role, value and state for every control
1.3.4 AA Lock no orientation
1.3.5 AA Let fields declare input purpose; autofill and password managers work
1.4.3, 1.4.11 AA Kit defaults reach 4.5:1 for text and 3:1 for control edges and focus; themes can be audited
1.4.4, 1.4.10 AA Lose nothing at 200% zoom or 320 px wide
1.4.5 AA Keep text as real text, available to assistive technology
1.4.12 AA Apply a person's text spacing with nothing lost
1.4.13 AA Make hover and focus content dismissible, hoverable and persistent
2.4.7 AA Keep focus visible
3.1.2 AA Let language be set per element
4.1.3 AA Announce status and error changes without moving focus

The other 18 criteria belong to the app: 1.2.x, 1.3.3, 1.4.2, 2.1.4, 2.2.2, 2.3.1, 2.4.4, 2.4.5, 2.4.6, 2.5.4, 3.2.3, 3.2.4, 3.3.3, 3.3.4. Rune must not block any of them.

Also:

  • One tree: the web exposes the same accessibility tree as native.
  • Assistive technology: works with VoiceOver on macOS and iOS, NVDA on Windows and TalkBack on Android, in Safari, Chrome, Firefox and Edge.
  • Continuity of support: publish the supported browsers and devices, with no dead end below that range.
  • Checks: repeatable browser checks in the repo for every row a machine can test, in the verification list, plus a list of what needs a person.

Out of scope

Conformance claims, human audits and app content. How to meet each row is yours to decide; canvas text can't take a user stylesheet, so 1.4.4 and 1.4.12 need a design choice.

Repro: the form used above

Built with scripts/web-build.sh at 781e2b6, depending on rune and rune-kit at that rev. window.__state reports what the app holds, because the canvas can't be read.

//! A plain form using only Rune Kit's public API at the pinned commit, for accessibility checks.
use rune::{AppSpec, Color, Cx, El, ScrollSpec, TextEdit, col, text};
use rune_kit::{Button, Checkbox, Field, Kit, TextInput, root};
use wasm_bindgen::prelude::*;

#[wasm_bindgen(inline_js = "export function report(s) { window.__contrast = s; }
export function state(e, p, r) { window.__state = { email: e, passwordLength: p, remember: r }; }")]
extern "C" { fn report(s: &str); fn state(e: &str, p: usize, r: bool); }

#[derive(Default)]
struct State { email: TextEdit, password: TextEdit, remember: bool, submitted: bool, status: Option<String> }

fn view(s: &State, _: &mut Cx<State>) -> El {
    state(&s.email.text, s.password.text.chars().count(), s.remember);
    let k = Kit::neutral(true);
    let bad = s.submitted && !s.email.text.contains('@');
    let body = col().role("main").w_full().h_full().scroll(ScrollSpec { stick_bottom: false }).padding(16.0).gap(12.0).fill(k.c.page)
        .child(text("Create your account").role("heading").level(1).color(k.c.text_base))
        .child(Field::new().label("Email address").control(TextInput::new(&s.email).invalid(bad)
            .on_edit(|s: &mut State| &mut s.email).build(&k)).build(&k))
        .child(Field::new().label("Password").control(TextInput::new(&s.password).secure()
            .on_edit(|s: &mut State| &mut s.password).build(&k)).build(&k))
        .child(Checkbox::new(s.remember).label("Remember this device")
            .on_toggle(|s: &mut State| s.remember = !s.remember).build(&k))
        .child(Button::new("Continue").on_press(|s: &mut State| {
            s.submitted = true;
            s.status = Some(if s.email.text.contains('@') { "Code sent".into() } else { "Enter a valid email address".into() });
        }).build(&k))
        .children(s.status.clone().map(|m| text(m).key("status").role("status").color(k.c.text_base)));
    root(body, Vec::new())
}

fn lum(c: Color) -> f32 { 0.2126 * c.r + 0.7152 * c.g + 0.0722 * c.b }
fn over(t: Color, b: Color) -> Color { let a = t.a; Color { r: t.r * a + b.r * (1.0 - a), g: t.g * a + b.g * (1.0 - a), b: t.b * a + b.b * (1.0 - a), a: 1.0 } }
fn contrast() -> String {
    let mut out = String::new();
    for dark in [true, false] {
        let c = Kit::neutral(dark).c;
        let base = over(c.bg_base, c.page);
        for (n, f, min) in [("text_base", c.text_base, 4.5), ("text_muted", c.text_muted, 4.5), ("text_faint", c.text_faint, 4.5),
            ("text_weak", c.text_weak, 4.5), ("text_accent", c.text_accent, 4.5), ("danger.fg", c.danger.fg, 4.5),
            ("border_weak", c.border_weak, 3.0), ("border_focus", c.border_focus, 3.0)] {
            let (x, y) = (lum(over(f, base)), lum(base));
            let r = (x.max(y) + 0.05) / (x.min(y) + 0.05);
            out.push_str(&format!("{} {} {:.2} need {} {}\n", if dark { "dark" } else { "light" }, n, r, min, if r < min { "FAIL" } else { "pass" }));
        }
    }
    out
}

#[wasm_bindgen(start)]
pub fn start() {
    report(&contrast());
    rune::run(AppSpec::new("Create your account", (390.0, 760.0), State::default, view));
}

Activity

  1. opencodejr commented on Nov 25, 2026

    @opencodejr
    Contributor

    Thanks for writing this up so thoroughly. The measured "Today" list and the repro form make it a concrete target, and splitting the platforms into #109, #110 and #111 helps.

    I'm treating this as a feature request. Some context from the current dev code (I haven't rerun your form, so this comes from reading the source, not a new measurement):

    • Web: render the AccessKit tree into the DOM accessibility mirror (roles, states, live regions, focus) #118 is closed as done via feat(web): mirror ARIA container roles, disabled/busy states, and range controls #1965. The web mirror now adds container roles (menu, tree, tabpanel, toolbar, grid, form, search and others), aria-disabled/aria-busy, slider and spinbutton values, and aria-checked/aria-pressed on the canvas aria-activedescendant focus proxy. Some items in your list may have moved since 781e2b6.
    • bridge.js now names the shared textarea from the focused field's label ('Text input' is only the fallback), and the password proxy sets autocomplete = 'current-password'. Per-field input purpose (1.3.5) and replacing the value on autofill still need checking.
    • WEB.md describes a CPU-canvas first paint (CpuFirst::Auto), an opt-in webgl fallback and --html pages that stay readable without a GPU. These cover part of the "no WebGPU" point.
    • scripts/web-build.sh still writes maximum-scale=1,user-scalable=no in the viewport meta, so the 1.4.4 pinch-zoom point still applies.

    The larger rows (reflow at 320 px, text spacing on canvas text, Kit palette contrast, DOM focus vs. the canvas, per-element lang, and in-repo browser checks plus a list of what needs a person) need design work. They'll likely be handled in separate pieces, not in one change.

  2. opencodejr commented on Nov 25, 2026

    @opencodejr
    Contributor

    I haven't made a code change for this one. It covers about 30 WCAG criteria across Rune, Rune Kit and scripts/web-build.sh, and several of the open rows need a design decision first:

    • Pinch zoom (1.4.4): web-build.sh still writes maximum-scale=1,user-scalable=no. But platform.js sizes and places the canvas from visualViewport, and the generated page sets touch-action:none. Just dropping the meta flags would change pinch behaviour for every mobile web app, so this needs a deliberate choice and a check in a real browser.
    • Text spacing (1.4.12) and reflow at 320 px (1.4.10): as you noted, canvas text can't take a user stylesheet. Whether that goes through the Text view, the DOM mirror or Cx settings is a design call.
    • Kit neutral contrast: raising border_weak, light text_faint and text_accent changes how every Kit app looks.
    • Input purpose (1.3.5): the field proxies are one shared <textarea> and one password <input>. Declaring a purpose per field needs a decision on which proxy carries autocomplete, and on whether autofill replaces or appends to typed text.

    Some of the list has changed on dev since 781e2b6 (from reading the code, not a new browser run):

    To move forward, it would help to rerun your form on current dev and file what still fails as separate issues, one gap each (for example: zoom and the viewport meta, per-field autocomplete, autofill replacing typed text, aria-invalid, Kit neutral contrast). Each can then be fixed and tested on its own.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions