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
4 changes: 3 additions & 1 deletion pkgs/id/web/src/goto-line.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ describe("go-to-line command", () => {
expect(input?.labels?.[0]).toBe(label);
});

it("creates a .goto-line-dialog element in the container", () => {
it("creates a .goto-line-dialog element in the container with dialog accessibility attributes", () => {
const { view, container } = createViewWithGotoLine("line1\nline2\nline3");
views.push(view);
containers.push(container);
Expand All @@ -158,6 +158,8 @@ describe("go-to-line command", () => {

const dialog = container.querySelector(".goto-line-dialog");
expect(dialog).not.toBeNull();
expect(dialog?.getAttribute("role")).toBe("dialog");
expect(dialog?.getAttribute("aria-label")).toBe("Go to line");
});

it("dialog contains an input element", () => {
Expand Down
2 changes: 2 additions & 0 deletions pkgs/id/web/src/goto-line.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ function getLineStartPos(view: EditorView, targetLine: number): number | null {
function createDialog(container: HTMLElement): HTMLElement {
const dialog = document.createElement("div");
dialog.className = "goto-line-dialog";
dialog.setAttribute("role", "dialog");
dialog.setAttribute("aria-label", "Go to line");
dialog.innerHTML = `
<label class="goto-line-label" for="goto-line-input">Go to Line:</label>
<input type="number" min="1" class="goto-line-input" id="goto-line-input" placeholder="Line #" autocomplete="off" />
Expand Down
4 changes: 3 additions & 1 deletion pkgs/id/web/src/search-panel.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ describe("search panel integration", () => {
expect(container.querySelector("#search-regex")).not.toBeNull();
});

it("panel has role=search for accessibility", () => {
it("panel has role=search and aria-label for accessibility", () => {
const { view, container } = createViewWithSearch();
activeView = view;
activeContainer = container;
Expand All @@ -264,6 +264,8 @@ describe("search panel integration", () => {

const panel = container.querySelector(".search-panel");
expect(panel?.getAttribute("role")).toBe("search");
expect(panel?.getAttribute("aria-label")).toBe("Find and replace");
expect(container.querySelector("#replace-all")?.getAttribute("aria-label")).toBe("Replace all");
});

it("opening panel twice does not create duplicate panels", () => {
Expand Down
3 changes: 2 additions & 1 deletion pkgs/id/web/src/search-panel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ function createPanel(container: HTMLElement): HTMLElement {
const panel = document.createElement("div");
panel.className = "search-panel";
panel.setAttribute("role", "search");
panel.setAttribute("aria-label", "Find and replace");

panel.innerHTML = `
<div class="search-panel-row">
Expand All @@ -114,7 +115,7 @@ function createPanel(container: HTMLElement): HTMLElement {
<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…" aria-label="Replace with" 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>
<button class="search-btn" id="replace-all" title="Replace all" aria-label="Replace all">All</button>
</div>
`;

Expand Down
Loading