Skip to content
Closed
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
3 changes: 3 additions & 0 deletions .Jules/palette.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## 2023-10-11 - Search Panel Accessibility
**Learning:** Dynamic UI components like search panels often update text content (like "1 of 5 matches") without focus shifting. Screen readers miss these updates unless `aria-live="polite"` and `aria-atomic="true"` are used on the indicator element. Additionally, icon-only buttons (`▲`, `▼`, `×`) often lack accessible names, requiring `aria-label` since `title` alone isn't always reliable across all assistive tech.
**Action:** Always verify that dynamic status text has appropriate `aria-live` regions and that all icon-only buttons include an `aria-label` attribute in addition to a `title` tooltip.
2 changes: 1 addition & 1 deletion .github/workflows/auto-assign.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
pull-requests: write
steps:
- name: 'Auto-assign issue'
uses: pozil/auto-assign-issue@v1
uses: pozil/auto-assign-issue@v4
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
assignees: dezren39
Expand Down
20 changes: 10 additions & 10 deletions pkgs/id/web/src/cursor-utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,21 @@
* These test the pure functions used in collaborative cursor management.
*/

import { describe, it, expect } from "vitest";
import { describe, expect, it } from "vitest";
import {
FADE_START_MS,
CURSOR_COLORS,
type CursorForMerge,
clusterOverlappingGroups,
doGroupsOverlap,
estimateTooltipWidth,
FADE_END_MS,
HIDE_MS,
FADE_START_MS,
getColorForClient,
getOpacityForAge,
getStrobeDurationMs,
isLightColor,
getColorForClient,
CURSOR_COLORS,
estimateTooltipWidth,
groupCursorsByPosition,
doGroupsOverlap,
clusterOverlappingGroups,
type CursorForMerge,
HIDE_MS,
isLightColor,
type PositionGroup,
} from "./cursor-utils";

Expand Down
4 changes: 2 additions & 2 deletions pkgs/id/web/src/editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { buildMenuItems, exampleSetup } from "prosemirror-example-setup";
import { gapCursor } from "prosemirror-gapcursor";
import { history } from "prosemirror-history";
import { keymap } from "prosemirror-keymap";
import { MenuItem, blockTypeItem, liftItem, redoItem, selectParentNodeItem, undoItem } from "prosemirror-menu";
import { blockTypeItem, liftItem, MenuItem, redoItem, selectParentNodeItem, undoItem } from "prosemirror-menu";
import { type MarkType, Node, Schema } from "prosemirror-model";
import { schema as basicSchema } from "prosemirror-schema-basic";
import { addListNodes } from "prosemirror-schema-list";
Expand Down Expand Up @@ -372,7 +372,7 @@ export function initEditor(
const browseImages = new MenuItem({
title: "Browse uploaded images",
label: "🖼",
run(state, _dispatch, edView) {
run(_state, _dispatch, edView) {
openImageBrowser(edView, editorSchema);
},
});
Expand Down
1 change: 0 additions & 1 deletion pkgs/id/web/src/image-node-view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ export class ImageNodeView implements NodeView {
// Resize state
private resizing = false;
private startX = 0;
private startY = 0;
private startWidth = 0;
private startHeight = 0;
private aspectRatio = 1;
Expand Down
24 changes: 12 additions & 12 deletions pkgs/id/web/src/search-panel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ const panelState: PanelState = {
/** Count total matches for display. */
function countMatches(view: EditorView): number {
const ss = getSearchState(view.state);
if (!ss || !ss.query.valid) return 0;
if (!ss?.query.valid) return 0;

let count = 0;
let result = ss.query.findNext(view.state, 0);
Expand All @@ -69,7 +69,7 @@ function countMatches(view: EditorView): number {
function updateMatchCount(view: EditorView): void {
if (!panelState.matchCountEl) return;
const ss = getSearchState(view.state);
if (!ss || !ss.query.valid || !ss.query.search) {
if (!ss?.query.valid || !ss.query.search) {
panelState.matchCountEl.textContent = "";
return;
}
Expand Down Expand Up @@ -104,22 +104,22 @@ function createPanel(container: HTMLElement): HTMLElement {

panel.innerHTML = `
<div class="search-panel-row">
<input type="text" id="search-input" class="search-field" placeholder="Find…" autocomplete="off" spellcheck="false" />
<span class="search-match-count" id="search-match-count"></span>
<button class="search-btn" id="search-prev" title="Previous (Shift+Enter)">&#x25B2;</button>
<button class="search-btn" id="search-next" title="Next (Enter)">&#x25BC;</button>
<input type="text" id="search-input" class="search-field" placeholder="Find…" aria-label="Find text" autocomplete="off" spellcheck="false" />
<span class="search-match-count" id="search-match-count" aria-live="polite" aria-atomic="true"></span>
<button class="search-btn" id="search-prev" title="Previous (Shift+Enter)" aria-label="Find previous">&#x25B2;</button>
<button class="search-btn" id="search-next" title="Next (Enter)" aria-label="Find next">&#x25BC;</button>
<label class="search-toggle" title="Case sensitive">
<input type="checkbox" id="search-case" /><span>Aa</span>
<input type="checkbox" id="search-case" aria-label="Match case sensitive" /><span>Aa</span>
</label>
<label class="search-toggle" title="Regular expression">
<input type="checkbox" id="search-regex" /><span>.*</span>
<input type="checkbox" id="search-regex" aria-label="Use regular expression" /><span>.*</span>
</label>
<button class="search-btn search-close" id="search-close" title="Close (Escape)">&times;</button>
<button class="search-btn search-close" id="search-close" title="Close (Escape)" aria-label="Close search panel">&times;</button>
</div>
<div class="search-panel-row search-replace-row" id="search-replace-row" style="display:none">
<input type="text" id="replace-input" class="search-field" placeholder="Replace…" autocomplete="off" spellcheck="false" />
<button class="search-btn" id="replace-one" title="Replace">Replace</button>
<button class="search-btn" id="replace-all" title="Replace all">All</button>
<input type="text" id="replace-input" class="search-field" placeholder="Replace…" aria-label="Replace text" autocomplete="off" spellcheck="false" />
<button class="search-btn" id="replace-one" title="Replace" aria-label="Replace current match">Replace</button>
<button class="search-btn" id="replace-all" title="Replace all" aria-label="Replace all matches">All</button>
</div>
`;

Expand Down
79 changes: 48 additions & 31 deletions pkgs/id/web/src/world.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,7 @@
/** Browser presentation for the server-authoritative world session. */

type WorldFrame = {
type:
| "snapshot"
| "event"
| "view"
| "records"
| "invite"
| "upload_ready"
| "module_installed"
| "error";
type: "snapshot" | "event" | "view" | "records" | "invite" | "upload_ready" | "module_installed" | "error";
snapshot?: {
world_id: string;
current_sequence: number;
Expand Down Expand Up @@ -72,10 +64,29 @@ function initWorld(): void {
const copyButton = element<HTMLButtonElement>(root, "[data-world-copy]");
const inviteOutput = element<HTMLElement>(root, "[data-world-invite-output]");
if (
!name || !admin || !capability || !worldInput || !inviteButton || !moduleInput || !moduleSeed || !installButton || !joinButton || !chatForm || !chatInput ||
!inputForm || !gameInput || !log || !view || !recordsView || !recordsRefresh || !participants ||
!status || !copyButton || !inviteOutput
) return;
!name ||
!admin ||
!capability ||
!worldInput ||
!inviteButton ||
!moduleInput ||
!moduleSeed ||
!installButton ||
!joinButton ||
!chatForm ||
!chatInput ||
!inputForm ||
!gameInput ||
!log ||
!view ||
!recordsView ||
!recordsRefresh ||
!participants ||
!status ||
!copyButton ||
!inviteOutput
)
return;

// `/world?world=arena` opens the page on that world.
worldInput.value = new URLSearchParams(window.location.search).get("world") ?? "";
Expand Down Expand Up @@ -152,11 +163,13 @@ function initWorld(): void {
recordsPending = false;
recordsView.textContent = JSON.stringify(records, null, 2);
} else {
socket?.send(JSON.stringify({
type: "records",
capability: capability.value.trim(),
after: recordsAfter,
}));
socket?.send(
JSON.stringify({
type: "records",
capability: capability.value.trim(),
after: recordsAfter,
}),
);
}
break;
}
Expand Down Expand Up @@ -185,10 +198,12 @@ function initWorld(): void {
recordsAfter = null;
recordsPending = true;
// This session is joined, so it can also ask for records.
socket.send(JSON.stringify({
type: "records",
capability: capability.value.trim(),
}));
socket.send(
JSON.stringify({
type: "records",
capability: capability.value.trim(),
}),
);
};

recordsRefresh.addEventListener("click", requestRecords);
Expand Down Expand Up @@ -276,15 +291,17 @@ function initWorld(): void {
const upload = new WebSocket(`${scheme}//${location.host}/ws/world`);
let uploadStarted = false;
upload.addEventListener("open", () => {
upload.send(JSON.stringify({
type: "install_begin",
admin_token: secret,
total_bytes: file.size,
// The host computes the canonical Iroh BLAKE3 hash and returns it.
module_hash: null,
seed,
world: selectedWorld(),
}));
upload.send(
JSON.stringify({
type: "install_begin",
admin_token: secret,
total_bytes: file.size,
// The host computes the canonical Iroh BLAKE3 hash and returns it.
module_hash: null,
seed,
world: selectedWorld(),
}),
);
});
upload.addEventListener("message", async (message) => {
let frame: WorldFrame;
Expand Down
Loading