Skip to content

A one-of-a-kind resume builder that keeps your privacy in mind. Completely secure, customizable, portable, open-source and free forever. Try it out today!

fix: preserve editor focus and reachable touch controls

Amruth Pillai978edf6da674
diff --git a/apps/mobile/scripts/outline-retention.test.mjs b/apps/mobile/scripts/outline-retention.test.mjs
index 0ab744c66..cf4545207 100644
--- a/apps/mobile/scripts/outline-retention.test.mjs
+++ b/apps/mobile/scripts/outline-retention.test.mjs
@@ -53,7 +53,7 @@ for (const via of ["inline options", "entry screen"]) {
name,
]),
);
- ui.useTheme = () => ({ space: { s2: 8, s3: 12, s4: 16 } });
+ ui.useTheme = () => ({ space: { s2: 8, s3: 12, s4: 16 }, size: { hit: 44 }, colors: {}, radius: {} });
const boundary = {
react,
"react-native": { Pressable: "Pressable", View: "View" },
@@ -61,12 +61,12 @@ for (const via of ["inline options", "entry screen"]) {
"@lingui/core/macro": {
plural: (count, forms) => (count === 1 ? forms.one : forms.other).replace("#", String(count)),
},
- "@lingui/react/macro": { useLingui: () => ({ t: tag }) },
+ "@lingui/react/macro": { useLingui: () => ({ t: tag, i18n }) },
"expo-image": { Image: "Image" },
"expo-router": { useRouter: () => ({ push() {} }) },
"@reactive-resume/utils/string": { getInitials: () => "FE" },
"./entry-sheet": { EntrySheet: "EntrySheet" },
- "./fields": { ADD_LABELS: {}, SECTION_ICONS: {}, SECTION_TITLES: {} },
+ "./fields": { ADD_LABELS: {}, SECTION_ICONS: {}, SECTION_TITLES: { experience: "Experience" } },
"./hooks": {
useWriteData: (select) => select(data),
edit: (write) => write(data),
@@ -118,7 +118,16 @@ for (const via of ["inline options", "entry screen"]) {
assert.ok(item, `Missing ${kind}`);
return current.renderItem({ item, drag() {}, isActive: false });
};
- row("section").props.onToggle();
+ const section = row("section");
+ const renderedSection = section.type(section.props);
+ const handle = nodes(renderedSection).find((node) => node.type?.name === "Handle");
+ assert.ok(handle, "actual section exposes its reorder handle");
+ const target = handle.type(handle.props);
+ assert.ok(
+ target.props.style.width >= 44 && target.props.style.height >= 44,
+ "native reorder target is at least 44 by 44",
+ );
+ section.props.onToggle();
if (via === "entry screen") row("entry").props.onOpen();
else {
row("entry").props.onOptions();
diff --git a/apps/mobile/src/features/write/outline.tsx b/apps/mobile/src/features/write/outline.tsx
index 331105067..c052acd7b 100644
--- a/apps/mobile/src/features/write/outline.tsx
+++ b/apps/mobile/src/features/write/outline.tsx
@@ -272,7 +272,7 @@ function Handle({ label, disabled, onDrag }: HandleProps) {
delayLongPress={250}
onLongPress={onDrag}
style={{
- width: size.hit * 0.7,
+ width: size.hit,
height: size.hit,
alignItems: "center",
justifyContent: "center",
diff --git a/apps/web/src/features/resume/editor/chrome.tsx b/apps/web/src/features/resume/editor/chrome.tsx
index bc3f737bc..d42cd56ce 100644
--- a/apps/web/src/features/resume/editor/chrome.tsx
+++ b/apps/web/src/features/resume/editor/chrome.tsx
@@ -242,7 +242,7 @@ export function DocumentMenuTrigger({ name, isLocked, ...props }: DocumentMenuTr
type="button"
{...props}
aria-label={t`Document menu: ${name}`}
- className="-mx-1.5 flex max-w-[calc(100%+0.75rem)] min-w-0 flex-col items-start rounded-md px-1.5 py-0.5 text-start transition-colors duration-quick hover:bg-hover"
+ className="-mx-1.5 flex max-w-[calc(100%+0.75rem)] min-w-0 flex-col items-start justify-center rounded-md px-1.5 py-0.5 text-start transition-colors duration-quick hover:bg-hover pointer-coarse:min-h-11"
>
<span className="flex max-w-full min-w-0 items-center gap-1.5">
<span dir="auto" className="truncate text-sm leading-[18px] font-semibold text-ink">
diff --git a/apps/web/src/features/resume/editor/write/section-row.tsx b/apps/web/src/features/resume/editor/write/section-row.tsx
index 75f3ac6bc..70444fe48 100644
--- a/apps/web/src/features/resume/editor/write/section-row.tsx
+++ b/apps/web/src/features/resume/editor/write/section-row.tsx
@@ -117,7 +117,7 @@ export function SectionRow({ section, locked, dragGroup, onMove, children }: Sec
aria-label={t`Reorder ${title}`}
disabled={locked || hidden}
className={cn(
- "flex h-11 w-7 shrink-0 cursor-grab items-center justify-center text-ink-3 active:cursor-grabbing disabled:cursor-default",
+ "flex h-11 w-7 shrink-0 cursor-grab items-center justify-center text-ink-3 active:cursor-grabbing disabled:cursor-default pointer-coarse:w-11",
hidden && "opacity-40",
)}
{...attributes}
@@ -132,7 +132,7 @@ export function SectionRow({ section, locked, dragGroup, onMove, children }: Sec
onClick={() => setOpen(section.id, !open)}
onKeyDown={onTitleKeyDown}
className={cn(
- "min-w-0 flex-1 truncate rounded-md py-1 text-start text-sm font-medium",
+ "min-w-0 flex-1 truncate rounded-md py-1 text-start text-sm font-medium pointer-coarse:h-11",
hidden && "text-ink-3 line-through",
)}
>
diff --git a/apps/web/src/routes/builder/$resumeId/-components/page-canvas.tsx b/apps/web/src/routes/builder/$resumeId/-components/page-canvas.tsx
index a3ec2c52e..9453e7cab 100644
--- a/apps/web/src/routes/builder/$resumeId/-components/page-canvas.tsx
+++ b/apps/web/src/routes/builder/$resumeId/-components/page-canvas.tsx
@@ -134,7 +134,7 @@ function ResumePageCanvas() {
}}
className={cn(
// The region takes focus to scroll from the keyboard: it shows the ring, inset since it fills its container.
- "absolute inset-0 overflow-auto pb-24 outline-none focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-accent",
+ "absolute inset-0 overflow-auto pb-24 focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-accent",
// Check keeps room above the page for the page-view toggle.
mode === "check" && !viewing ? "pt-[68px]" : "pt-7",
isPhone ? "px-4" : "px-10",
diff --git a/tests/e2e/specs/editor-control-accessibility.spec.ts b/tests/e2e/specs/editor-control-accessibility.spec.ts
new file mode 100644
index 000000000..49d6529ed
--- /dev/null
+++ b/tests/e2e/specs/editor-control-accessibility.spec.ts
@@ -0,0 +1,109 @@
+import type { Page } from "@playwright/test";
+import { expect, test } from "../fixtures/test";
+async function resume(page: Page) {
+ const r = await page.request.post("/api/openapi/resumes", {
+ data: { name: "Fictional accessible resume", tags: [], withSampleData: true },
+ });
+ await expect(r).toBeOK();
+ return r.json();
+}
+test("resume page keyboard focus remains visible", async ({ authPage: page }) => {
+ const id = await resume(page);
+ await page.goto(`/builder/${id}`);
+ await page.keyboard.press("Tab");
+ const region = page.getByRole("region", { name: "Resume page", exact: true });
+ await region.focus();
+ await expect(region).toBeFocused();
+ await expect(region).toHaveCSS("outline-style", "solid");
+ await expect(region).toHaveCSS("outline-width", "2px");
+ expect(await region.evaluate((e) => e.matches(":focus-visible"))).toBe(true);
+});
+test("touch editor controls expose44px targets and keep section actions reachable", async ({
+ authPage: page,
+ browser,
+}) => {
+ const id = await resume(page);
+ const context = await browser.newContext({
+ hasTouch: true,
+ viewport: { width: 820, height: 1180 },
+ storageState: await page.context().storageState(),
+ });
+ const touch = await context.newPage();
+ try {
+ await touch.goto(`/builder/${id}`);
+ await touch.getByRole("button", { name: "Show panel", exact: true }).click();
+ await expect(touch.getByRole("complementary", { name: "Editor", exact: true })).toBeVisible();
+ const menu = touch.getByRole("button", { name: "Document menu: Fictional accessible resume", exact: true });
+ const controls = [
+ touch.getByRole("button", { name: "Zoom in", exact: true }),
+ touch.getByRole("button", { name: "Zoom out", exact: true }),
+ touch.getByRole("button", { name: "Fit page to width", exact: true }),
+ menu,
+ touch.getByRole("button", { name: "Reorder Experience", exact: true }),
+ touch.locator("#sidebar-experience").getByRole("button", { name: "Experience", exact: true }),
+ ];
+ for (const control of controls) {
+ await expect(control).toBeVisible();
+ expect(
+ await control.evaluate((e) => {
+ const r = e.getBoundingClientRect();
+ return [getComputedStyle(e), getComputedStyle(e, "::before"), getComputedStyle(e, "::after")].some(
+ (c) =>
+ Math.max(r.width, Number.parseFloat(c.width) || 0) >= 44 &&
+ Math.max(r.height, Number.parseFloat(c.height) || 0) >= 44,
+ );
+ }),
+ ).toBe(true);
+ }
+ await expect(touch.getByText(/drag ·/)).toBeHidden();
+ await touch.locator("#sidebar-experience").getByRole("button", { name: "Experience", exact: true }).tap();
+ await expect(touch.getByRole("button", { name: "Add experience", exact: true })).toBeVisible();
+ const box = await menu.boundingBox();
+ if (!box) throw Error("missing menu");
+ await touch.touchscreen.tap(box.x + box.width / 2, box.y + box.height - 4);
+ await expect(touch.getByRole("menuitem", { name: "Tags…", exact: true })).toBeVisible();
+ } finally {
+ await context.close();
+ }
+});
+
+test("touch document hit area leaves failed-save Retry usable", async ({ authPage: page, browser }) => {
+ const id = await resume(page);
+ const context = await browser.newContext({
+ hasTouch: true,
+ viewport: { width: 820, height: 1180 },
+ storageState: await page.context().storageState(),
+ });
+ const touch = await context.newPage();
+ try {
+ await touch.goto(`/builder/${id}`);
+ await touch.getByRole("button", { name: "Show panel", exact: true }).click();
+ await expect(touch.getByRole("complementary", { name: "Editor", exact: true })).toBeVisible();
+ await touch.route("**/api/rpc/resume/update", (route) =>
+ route.fulfill({
+ status: 500,
+ contentType: "application/json",
+ body: JSON.stringify({
+ json: { defined: false, code: "INTERNAL_SERVER_ERROR", status: 500, message: "Fictional save unavailable" },
+ }),
+ }),
+ );
+ await touch.getByRole("textbox", { name: "Full name", exact: true }).fill("Riley Harper");
+ await expect(touch.getByRole("alert").filter({ hasText: "Not saved" })).toBeVisible();
+ const retry = touch.getByRole("button", { name: "Retry saving", exact: true });
+ await expect(retry).toBeVisible();
+ expect(await retry.evaluate((e) => e.closest('[role="status"],[role="alert"]'))).toBeNull();
+ await touch.unroute("**/api/rpc/resume/update");
+ await retry.tap();
+ await expect
+ .poll(async () => {
+ const response = await touch.request.get(`/api/openapi/resumes/${id}`);
+ expect(response.ok()).toBe(true);
+ return (await response.json()).data.basics.name;
+ })
+ .toBe("Riley Harper");
+ await expect(touch.getByRole("menu")).toHaveCount(0);
+ } finally {
+ await context.close();
+ }
+});