Spaces:
Running on Zero
Running on Zero
fix: clarify export control accessibility
Browse filesCo-authored-by: Codex <noreply@openai.com>
- static/app.js +9 -0
- static/index.html +31 -4
- tests/test_frontend_copy.py +5 -0
static/app.js
CHANGED
|
@@ -685,6 +685,7 @@ function renderIdeas(ideas) {
|
|
| 685 |
item.disabled = sessionControlsLocked;
|
| 686 |
item.dataset.ideaId = idea.id || "";
|
| 687 |
item.setAttribute("aria-pressed", selected ? "true" : "false");
|
|
|
|
| 688 |
item.innerHTML = `
|
| 689 |
<div class="ihead">
|
| 690 |
<strong>${escapeHtml(idea.title)}</strong>
|
|
@@ -705,6 +706,14 @@ function visibleIdeas(ideas) {
|
|
| 705 |
return current ? [current, ...remaining] : ideas.slice(-4).reverse();
|
| 706 |
}
|
| 707 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 708 |
function currentIdea() {
|
| 709 |
const ideas = Array.isArray(session.ideas) ? session.ideas : [];
|
| 710 |
return ideas.find((idea) => idea.id === session.current_idea_id) || ideas[ideas.length - 1] || null;
|
|
|
|
| 685 |
item.disabled = sessionControlsLocked;
|
| 686 |
item.dataset.ideaId = idea.id || "";
|
| 687 |
item.setAttribute("aria-pressed", selected ? "true" : "false");
|
| 688 |
+
item.setAttribute("aria-label", ideaCardAriaLabel(idea, score, verdict));
|
| 689 |
item.innerHTML = `
|
| 690 |
<div class="ihead">
|
| 691 |
<strong>${escapeHtml(idea.title)}</strong>
|
|
|
|
| 706 |
return current ? [current, ...remaining] : ideas.slice(-4).reverse();
|
| 707 |
}
|
| 708 |
|
| 709 |
+
function ideaCardAriaLabel(idea, score, verdict) {
|
| 710 |
+
const title = String(idea?.title || "Untitled idea").trim() || "Untitled idea";
|
| 711 |
+
const parts = [`Select idea: ${title}`];
|
| 712 |
+
if (score) parts.push(`score ${score}`);
|
| 713 |
+
if (verdict) parts.push(String(verdict));
|
| 714 |
+
return parts.join(", ");
|
| 715 |
+
}
|
| 716 |
+
|
| 717 |
function currentIdea() {
|
| 718 |
const ideas = Array.isArray(session.ideas) ? session.ideas : [];
|
| 719 |
return ideas.find((idea) => idea.id === session.current_idea_id) || ideas[ideas.length - 1] || null;
|
static/index.html
CHANGED
|
@@ -145,11 +145,24 @@
|
|
| 145 |
Compare
|
| 146 |
</button>
|
| 147 |
<span class="spacer"></span>
|
| 148 |
-
<button
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 149 |
<svg class="icon"><use href="#icon-example"></use></svg>
|
| 150 |
Example
|
| 151 |
</button>
|
| 152 |
-
<button
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 153 |
<svg class="icon"><use href="#icon-download"></use></svg>
|
| 154 |
Notes
|
| 155 |
</button>
|
|
@@ -158,16 +171,30 @@
|
|
| 158 |
id="export-chapter"
|
| 159 |
class="btn btn-ghost"
|
| 160 |
title="Export the idea-board chapter"
|
|
|
|
| 161 |
disabled
|
| 162 |
>
|
| 163 |
<svg class="icon"><use href="#icon-download"></use></svg>
|
| 164 |
Chapter
|
| 165 |
</button>
|
| 166 |
-
<button
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 167 |
<svg class="icon"><use href="#icon-download"></use></svg>
|
| 168 |
PNG
|
| 169 |
</button>
|
| 170 |
-
<button
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 171 |
<svg class="icon"><use href="#icon-reset"></use></svg>
|
| 172 |
<span class="sr-only">Reset</span>
|
| 173 |
</button>
|
|
|
|
| 145 |
Compare
|
| 146 |
</button>
|
| 147 |
<span class="spacer"></span>
|
| 148 |
+
<button
|
| 149 |
+
type="button"
|
| 150 |
+
id="load-demo"
|
| 151 |
+
class="btn btn-ghost"
|
| 152 |
+
title="Load a sample session"
|
| 153 |
+
aria-label="Load example idea board"
|
| 154 |
+
>
|
| 155 |
<svg class="icon"><use href="#icon-example"></use></svg>
|
| 156 |
Example
|
| 157 |
</button>
|
| 158 |
+
<button
|
| 159 |
+
type="button"
|
| 160 |
+
id="export-notes"
|
| 161 |
+
class="btn btn-ghost"
|
| 162 |
+
title="Export build notes"
|
| 163 |
+
aria-label="Export build notes"
|
| 164 |
+
disabled
|
| 165 |
+
>
|
| 166 |
<svg class="icon"><use href="#icon-download"></use></svg>
|
| 167 |
Notes
|
| 168 |
</button>
|
|
|
|
| 171 |
id="export-chapter"
|
| 172 |
class="btn btn-ghost"
|
| 173 |
title="Export the idea-board chapter"
|
| 174 |
+
aria-label="Export idea-board chapter"
|
| 175 |
disabled
|
| 176 |
>
|
| 177 |
<svg class="icon"><use href="#icon-download"></use></svg>
|
| 178 |
Chapter
|
| 179 |
</button>
|
| 180 |
+
<button
|
| 181 |
+
type="button"
|
| 182 |
+
id="export-artifact"
|
| 183 |
+
class="btn btn-ghost"
|
| 184 |
+
title="Export the current page"
|
| 185 |
+
aria-label="Export current page as PNG"
|
| 186 |
+
disabled
|
| 187 |
+
>
|
| 188 |
<svg class="icon"><use href="#icon-download"></use></svg>
|
| 189 |
PNG
|
| 190 |
</button>
|
| 191 |
+
<button
|
| 192 |
+
type="button"
|
| 193 |
+
id="reset-session"
|
| 194 |
+
class="btn btn-ghost btn-icon"
|
| 195 |
+
title="Reset the session"
|
| 196 |
+
aria-label="Reset session"
|
| 197 |
+
>
|
| 198 |
<svg class="icon"><use href="#icon-reset"></use></svg>
|
| 199 |
<span class="sr-only">Reset</span>
|
| 200 |
</button>
|
tests/test_frontend_copy.py
CHANGED
|
@@ -14,6 +14,11 @@ def test_main_interface_copy_is_builder_facing() -> None:
|
|
| 14 |
assert "/api/artifact.png" in app_js
|
| 15 |
assert "renderArtifactCanvas" not in app_js
|
| 16 |
assert "canvas.toDataURL" not in app_js
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
|
| 18 |
stale_jargon = [
|
| 19 |
"No wax path pressed.",
|
|
|
|
| 14 |
assert "/api/artifact.png" in app_js
|
| 15 |
assert "renderArtifactCanvas" not in app_js
|
| 16 |
assert "canvas.toDataURL" not in app_js
|
| 17 |
+
assert 'aria-label="Export build notes"' in html
|
| 18 |
+
assert 'aria-label="Export idea-board chapter"' in html
|
| 19 |
+
assert 'aria-label="Export current page as PNG"' in html
|
| 20 |
+
assert "ideaCardAriaLabel" in app_js
|
| 21 |
+
assert "Select idea:" in app_js
|
| 22 |
|
| 23 |
stale_jargon = [
|
| 24 |
"No wax path pressed.",
|