Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions skills/leaf/scripts/leaf/render-checks/reachability.js
Original file line number Diff line number Diff line change
Expand Up @@ -255,8 +255,17 @@ export function unreachableWords() {
if (el.closest(".lf-work-line")) continue;
// .lf-quiet is words for a reader listening, clipped to nothing: not on
// screen, so there is nothing here the eye can see and the pointer can't
// reach — the failure this check exists for.
if (el.closest(".lf-quiet")) continue;
// reach — the failure this check exists for. [hidden] is the other half of
// that same silence and the one the runtime reaches for where a clip cannot
// go: the external-link note is an aria-describedby target inside whatever
// root its link stands in, shadow roots included, and .lf-quiet's rule is a
// document stylesheet that no shadow tree adopts. The attribute is safe to
// read as "not shown" because the browser drops it on the reveal — a
// hidden="until-found" word the reader finds is a word this check sees
// again, at the moment it is on screen. The two sibling checks that ask what
// a box shows (render-checks/widgets.js, render-checks/standalone.js) spell
// the same pair.
if (el.closest(".lf-quiet, [hidden]")) continue;

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[hidden] also matches hidden="until-found", which is what an inactive lf-tabs panel and a settled lf-options' cards wear — so this silences a declaration fault the gate has no second reading to catch later. Narrowing keeps the corpus green and keeps the reach:

Suggested change
if (el.closest(".lf-quiet, [hidden]")) continue;
if (el.closest('.lf-quiet, [hidden]:not([hidden="until-found"])')) continue;

found.push(
`${at(widget(el))} puts ${JSON.stringify(n.data.trim().slice(0, 40))} ` +
`under .lf-ui, where no comment can reach it`,
Expand Down
43 changes: 42 additions & 1 deletion tests/test_render_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,14 @@ def test_render_reports_words_a_widget_puts_out_of_reach(browser, serve):
The second one no marker can fix, which is why it reads differently: a word inside a
form control is unselectable in every engine, so a widget that reaches for <button>
has put its label somewhere the user cannot go. `selectableOffer` is the explicit
exception for such page words, and this says when a widget needed it."""
exception for such page words, and this says when a widget needed it.

Both are about a word the reader was shown, so the check asks that first. The
runtime's external-link note is the case that made it say so: an aria-describedby
target the browser reads out and the page never paints, put inside whatever root
its link stands in — a shadow tree included, where .lf-quiet's clip does not
reach. [hidden] is the silence available in every root, and the same note shown is
still reported."""
assert render_gate_model.render_version(browser, serve(CARRIED_PAGE)) == [], (
"the same page without the two mistakes has nothing to report"
)
Expand All @@ -538,6 +545,40 @@ def put_native_link(page):
== []
), "a native link's words label its browser-owned control rather than the page"

def put_note(hidden):
def go(page):
page.add_init_script(
"""addEventListener('DOMContentLoaded', () => {
const note = document.createElement('span');
note.className = 'lf-ui';
note.hidden = HIDDEN;
note.textContent = 'opens in a new tab';
document.getElementById('c-lax').prepend(note);
}, {once: true});""".replace("HIDDEN", "true" if hidden else "false")
)

return go

assert (
render_gate_model.render_version(
primed(browser, put_note(True)), serve(CARRIED_PAGE)
)
== []
), "a word the page never shows is not a word the reader was shown and denied"
assert sorted(
{
f.split("] ", 1)[1]
for f in render_gate_model.render_version(
primed(browser, put_note(False)), serve(CARRIED_PAGE)
)
}
) == [
(
'<lf-option id=c-lax> puts "opens in a new tab" under .lf-ui, where no '
"comment can reach it"
)
], "the same note shown is the failure this check exists for"

def put_words_out_of_reach(page):
page.add_init_script(
"""addEventListener('DOMContentLoaded', () => {
Expand Down
Loading