arXiv:2610.32934cs.SEOct 2026

Manuscript Offprint

arXiv:2610.32934

Runtime BiDi Structural Verification Catches Right-to-Left Layout Defects that Accessibility, Actionability, and Logical-Property Linting Miss

Karan Yadav

Karan Yadav

Google

Abstract—Bidirectional (right-to-left, RTL) layout defects arise when interfaces authored with physical directional CSS (margin-left, border-left, text-align:left) are rendered under dir="rtl" without being mirrored. Accessibility engines (axe-core), actionability engines (Playwright), and even Stylelint's current core logical-property rule systematically fail to localise these defects. We present runtime structural invariants—a zero-golden mode over computed style and geometry, and a bidi-conservative differential mode—that catch them in a headless browser. On a held-out benchmark of 14 real RTL bugs reconstructed from dated fix commits in Bootstrap and Material Components Web, the detector recovers 13/14 (2 via zero-golden, 11 via the differential mode), with no false alarm on any patched version; on genuinely real historical compiled CSS it catches 1 of 2 attempted (the miss consistent with the reconstruction), using the actual committed bootstrapRTL.css. On 16 negative LTR-island cases (8 of them hard) it reports 0 false positives, and both modes report 0 false positives on 43 unmodified real components across four design systems and three RTL architectures (rule-of-three 95% upper bound ≤ 7%). Along the way it surfaced a real directional defect—a physical text-align:left in .menu-list—in the current Bulma 1.0.4. By contrast, Stylelint's core rule emits an identical 1744 warnings on Bootstrap's LTR and correct-RTL builds (it cannot triage a defect from intentional physical CSS), pseudo-localisation detects none of the mirroring bugs, and a naive pixel mirror-and-diff reaches only F1 0.87 with a test-set-tuned threshold, whereas the differential needs none. We measure the two modes' limits directly and find them complementary: on a decoration/styling-asymmetry class, zero-golden recovers 5/6 physical-left bugs but false-flags the correct logical border-inline-end (4 of 4 border cases; 0 of 2 padding/margin), which computes to a left border under RTL, while the differential detects 0/6 of the same bugs yet never false-alarms—so on our benchmarks the differential is empirically exact (0 false alarms, no misses) only on the block-level inset/margin class, and zero-golden is the sole detector of the decoration class. We scope this paper to detection; repair is future work.

Index Terms—right-to-left layout, bidirectional text, CSS logical properties, web accessibility, layout verification, internationalization

I. INTRODUCTION

Web interfaces are increasingly localised into RTL scripts (Arabic, Hebrew, Persian, Urdu). The correct, direction-agnostic way to author them is with CSS logical properties (margin-inline-start, border-inline-start, text-align:start), which resolve to the physical right edge under dir="rtl". In practice, however, real design systems remain overwhelmingly physical. Measuring six shipped stylesheets (Section IV-A) we find 111–894 physical directional declarations each and near-zero logical adoption (the sole exception, Bulma, still ships 157); the dominant coping strategy is to maintain a second, machine-mirrored stylesheet (e.g. Bootstrap ships both bootstrap.css and bootstrapRTL.css). A component rendered under dir="rtl" with the un-mirrored stylesheet—a common and easily made misconfiguration—then exhibits directional defects: start-side accents on the wrong edge, unmirrored directional icons, and popups clipped at the wrong viewport boundary.

We set out to build a zero-golden detector—one needing no reference render—and found empirically that the dominant real-world defect class is not the styling asymmetry it targets but physical inset/margin offsets, which require a second, differential render: on real mined bugs the zero-golden mode accounts for only 2 of 13 detections. The two modes prove complementary—zero-golden is the only mode that detects the decoration/styling-asymmetry class, the differential the only mode for the dominant inset/margin class—and that division of labour is this paper’s empirical arc.

Existing structural web-verification tools were not designed for this failure mode. ReDeCheck [2] detects element-overlap and responsive-breakpoint faults; VizAssert [3] verifies visual-logic assertions; and internationalisation-presentation tools [1], [5] model horizontal string expansion between translations, not directional mirroring. Industrial engines target orthogonal properties: axe-core [9] checks accessibility rules [8] and Playwright [10] checks pointer actionability. Static linters can flag physical properties in source, but—as we show—they are directionally blind and cannot see inline, computed, or runtime-injected styles.

Contributions. (1) Runtime RTL structural invariants in two complementary modes—zero-golden (single render, a heuristic; the only mode that detects the decoration/styling-asymmetry class) and differential (bidi-conservative; empirically exact on the block-level inset/margin class it dominates, 11 of 13 detections)—with the empirical finding that neither mode subsumes the other. (2) A held-out recall evaluation on 14 real RTL bugs reconstructed from dated fix commits (two cross-checked against the actual committed historical bootstrapRTL.css, one caught and one missed), and a precision evaluation on 43 unmodified real library components—all code we did not author—together with 16 authored LTR-island micro-benchmarks (8 genuinely hard) that stress the RTL-script precision gate. (3) A reproducible comparison against real axe-core, Playwright, Stylelint's current core rule, pseudo-localisation, and a naive pixel mirror-and-diff, plus a prevalence and RTL-bug-history study of six shipped design systems. We scope this paper to detection; repair is future work.