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!
TypeScript agent-skillsaidsh-pluginhacktoberfestjavascriptmcp-serverreactresume-builderself-hostedtypescript
fix: retain phone toolbar and node selection keyboard flow
Amruth Pillaib1973653f46b
diff --git a/apps/mobile/locales/kn-IN.po b/apps/mobile/locales/kn-IN.poindex fc0c7eb34..38fe196d5 100644--- a/apps/mobile/locales/kn-IN.po+++ b/apps/mobile/locales/kn-IN.po@@ -11157,7 +11157,7 @@ msgstr "ಸ್ಕ್ರೀನಿಂಗ್"#: src/features/documents/library.tsx#: src/ui/fields.tsxmsgid "Search"-msgstr "ಹುಡುಕಿ Kannada"+msgstr "ಹುಡುಕಿ"#: src/features/ai/web-access.tsxmsgid "Search and enhanced reading"diff --git a/apps/web/locales/kn-IN.po b/apps/web/locales/kn-IN.poindex 4ece7d46f..a846e966d 100644--- a/apps/web/locales/kn-IN.po+++ b/apps/web/locales/kn-IN.po@@ -13953,7 +13953,7 @@ msgstr "ಸ್ಕ್ರೀನಿಂಗ್"#: src/routes/dashboard/-components/app-shell.tsx#: src/routes/dashboard/applications/index.tsxmsgid "Search"-msgstr "ಹುಡುಕಿ Kannada"+msgstr "ಹುಡುಕಿ"#: src/features/settings/ai/web-access.tsxmsgid "Search and enhanced reading"diff --git a/apps/web/src/components/layout/navigation-focus.test.tsx b/apps/web/src/components/layout/navigation-focus.test.tsxindex abeca7d3a..e7470008a 100644--- a/apps/web/src/components/layout/navigation-focus.test.tsx+++ b/apps/web/src/components/layout/navigation-focus.test.tsx@@ -1,6 +1,7 @@// @vitest-environment happy-domimport { act, render, screen, waitFor } from "@testing-library/react";import { expect, it } from "vite-plus/test";+import { Toast } from "@base-ui/react/toast";import {createMemoryHistory,createRootRoute,@@ -12,6 +13,7 @@ import {} from "@tanstack/react-router";import { AlertDialog, AlertDialogContent, AlertDialogTitle } from "@reactive-resume/ui/components/alert-dialog";import { Dialog, DialogContent, DialogTitle } from "@reactive-resume/ui/components/dialog";+import { Toaster } from "@reactive-resume/ui/components/toast";import { NavigationFocus } from "./navigation-focus";import { getPageTitle } from "@/libs/seo";@@ -55,18 +57,14 @@ it.each(["dialog", "alertdialog"] as const)("retains initial %s focus when its rit.each([false, true])("updates route focus despite a nonmodal toast (%s), retaining field focus for search changes",async (toast) => {+ const notifications = Toast.createToastManager();const root = createRootRoute({component: () => (- <>+ <Toaster toastManager={notifications}><HeadContent />- {toast && (- <div role="dialog" aria-modal="false" data-slot="toast">- Account created- </div>- )}<NavigationFocus /><Outlet />- </>+ </Toaster>),});const one = createRoute({@@ -96,6 +94,12 @@ it.each([false, true])(});render(<RouterProvider router={router} />);await waitFor(() => expect(screen.getByRole("heading", { name: "One" })).toHaveFocus());+ if (toast) {+ act(() => {+ notifications.add({ description: "Account created", timeout: 0 });+ });+ await screen.findByText("Account created");+ }await router.navigate({ to: "/two" });await waitFor(() => expect(screen.getByRole("heading", { name: "Two" })).toHaveFocus());expect(document.title).toBe("Two | Reactive Resume");diff --git a/apps/web/src/features/resume/editor/write/rich-text-editor-field.tsx b/apps/web/src/features/resume/editor/write/rich-text-editor-field.tsxindex 5baeb584c..0e2edcef1 100644--- a/apps/web/src/features/resume/editor/write/rich-text-editor-field.tsx+++ b/apps/web/src/features/resume/editor/write/rich-text-editor-field.tsx@@ -7,10 +7,9 @@ import type { ReactNode } from "react";import { Toolbar } from "@base-ui/react/toolbar";import { t } from "@lingui/core/macro";import { Plural, Trans } from "@lingui/react/macro";-import { TextSelection } from "@tiptap/pm/state";+import { NodeSelection, TextSelection } from "@tiptap/pm/state";import { EditorContent, useEditor, useEditorState } from "@tiptap/react";import { useEffect, useMemo, useRef, useState } from "react";-import { createPortal } from "react-dom";import {DropdownMenu,DropdownMenuCheckboxItem,@@ -243,11 +242,17 @@ export function RichTextEditor({view.dom.contains(range.anchorNode) &&view.dom.contains(range.focusNode)) {- const selection = TextSelection.between(- view.state.doc.resolve(view.posAtDOM(range.anchorNode, range.anchorOffset)),- view.state.doc.resolve(view.posAtDOM(range.focusNode, range.focusOffset)),- );- if (!selection.eq(view.state.selection)) view.dispatch(view.state.tr.setSelection(selection));+ const anchor = view.posAtDOM(range.anchorNode, range.anchorOffset);+ const head = view.posAtDOM(range.focusNode, range.focusOffset);+ const current = view.state.selection;+ const sameNode =+ current instanceof NodeSelection &&+ Math.min(anchor, head) === current.from &&+ Math.max(anchor, head) === current.to;+ if (!sameNode) {+ const selection = TextSelection.between(view.state.doc.resolve(anchor), view.state.doc.resolve(head));+ if (!selection.eq(current)) view.dispatch(view.state.tr.setSelection(selection));+ }}return false;}@@ -327,10 +332,6 @@ export function RichTextEditor({}, [editor, focusRequest]);const editing = focused || improving !== null || menus.open;- // Phones dock the toolbar above the keyboard. Inside a sheet it renders in that sheet, so Tab reaches it after the- // text (the sheet keeps focus within itself) instead of skipping it.- const [fieldElement, setFieldElement] = useState<HTMLDivElement | null>(null);- const toolbarHost = fieldElement?.closest<HTMLElement>('[role="dialog"]') ?? null;const acceptImprove = (line: ImproveLine, text: string) => {if (!editor) return;@@ -399,7 +400,6 @@ export function RichTextEditor({return (<div- ref={setFieldElement}onFocus={() => setFocused(true)}onBlur={(event) => {const next = event.relatedTarget;@@ -414,34 +414,6 @@ export function RichTextEditor({className,)}>- {/* On phones the toolbar docks above the keyboard, with Done to put the keyboard away. */}- {editing &&- !readOnlyTable &&- mobile &&- createPortal(- <Toolbar.Root- ref={toolbar}- aria-label={t`Formatting`}- style={{ bottom: keyboardInset }}- className="fixed inset-x-0 z-50 flex h-11 items-center gap-0.5 border-t border-line bg-raised px-1.5 shadow-e2"- >- <div className="flex min-w-0 flex-1 items-center gap-0.5 overflow-x-auto">{toolbarButtons}</div>- <Toolbar.Button- type="button"- onMouseDown={(event) => event.preventDefault()}- onClick={() => {- setImproving(null);- setFocused(false);- editor?.commands.blur();- }}- className="flex h-11 shrink-0 items-center rounded-md px-3 text-sm font-semibold text-accent-text"- >- <Trans>Done</Trans>- </Toolbar.Button>- </Toolbar.Root>,- toolbarHost ?? document.body,- )}-{readOnlyTable && (<p role="status" className="border-b border-line px-3 py-2 text-xs text-ink-2"><Trans>@@ -451,6 +423,30 @@ export function RichTextEditor({)}<EditorContent editor={editor} />+ {/* On phones the toolbar docks above the keyboard, with Done to put the keyboard away. */}+ {editing && !readOnlyTable && mobile && (+ <Toolbar.Root+ ref={toolbar}+ aria-label={t`Formatting`}+ style={{ bottom: keyboardInset }}+ className="fixed inset-x-0 z-50 flex h-11 items-center gap-0.5 border-t border-line bg-raised px-1.5 shadow-e2"+ >+ <div className="flex min-w-0 flex-1 items-center gap-0.5 overflow-x-auto">{toolbarButtons}</div>+ <Toolbar.Button+ type="button"+ onMouseDown={(event) => event.preventDefault()}+ onClick={() => {+ setImproving(null);+ setFocused(false);+ editor?.commands.blur();+ }}+ className="flex h-11 shrink-0 items-center rounded-md px-3 text-sm font-semibold text-accent-text"+ >+ <Trans>Done</Trans>+ </Toolbar.Button>+ </Toolbar.Root>+ )}+{editing && <AiProviderLoadState state={ai} />}{/* Room for the docked toolbar, so the end of the text and its hints can scroll clear of it. */}{editing && !readOnlyTable && mobile && <div aria-hidden="true" className="h-11" />}diff --git a/apps/web/src/features/resume/editor/write/rich-text-editor.test.tsx b/apps/web/src/features/resume/editor/write/rich-text-editor.test.tsxindex c331e44c5..b7b982459 100644--- a/apps/web/src/features/resume/editor/write/rich-text-editor.test.tsx+++ b/apps/web/src/features/resume/editor/write/rich-text-editor.test.tsx@@ -34,11 +34,7 @@ it.each([false, true])(editor.focus();});const bold = screen.getByRole("button", { name: "Bold" });- if (mobile)- await act(async () => {- bold.focus();- });- else await userEvent.tab();+ await userEvent.tab();expect(document.activeElement).toBe(bold);const toolbar = screen.getByRole("toolbar", { name: "Formatting" });expect(Array.from(toolbar.querySelectorAll("button")).filter((button) => button.tabIndex === 0).length).toBe(1);diff --git a/apps/web/src/routes/builder/$resumeId/-components/editor-bar.tsx b/apps/web/src/routes/builder/$resumeId/-components/editor-bar.tsxindex 93a01e589..9f1cdf476 100644--- a/apps/web/src/routes/builder/$resumeId/-components/editor-bar.tsx+++ b/apps/web/src/routes/builder/$resumeId/-components/editor-bar.tsx@@ -119,11 +119,7 @@ function ModeTabs({ compact }: ModeTabsProps) {><Icon name={MODE_ICONS[mode]} size={18} /><span className={compact ? "sr-only" : undefined}>{labels[mode]}</span>- {mode === "check" && (- <span className={compact ? "absolute -end-1 -top-1" : undefined}>- <CheckBadge count={issueCount} />- </span>- )}+ {mode === "check" && <CheckBadge count={issueCount} />}{mode === "share" && isPublic && (<span className="size-1.5 rounded-sm bg-accent" aria-hidden="true" title={t`Public`} />)}diff --git a/tests/e2e/specs/deferred-accessibility.spec.ts b/tests/e2e/specs/deferred-accessibility.spec.tsindex 7fc027141..5f8b23de4 100644--- a/tests/e2e/specs/deferred-accessibility.spec.ts+++ b/tests/e2e/specs/deferred-accessibility.spec.ts@@ -55,6 +55,31 @@ test("tablet mode icons leave space for the document title", async ({ authPage:await page.screenshot({ animations: "disabled", path: info.outputPath("tablet-title.png") });});+test("tablet long titles truncate and three-digit Check badges keep their own space", async ({ authPage: page }) => {+ const name = "Fictional accessibility engineering resume with a deliberately long document title";+ const created = await page.request.post("/api/openapi/resumes", { data: { name, tags: [] } });+ await expect(created).toBeOK();+ await page.setViewportSize({ width: 640, height: 1024 });+ await page.goto(`/builder/${await created.json()}`);+ const title = page.getByRole("button", { name: `Document menu: ${name}`, exact: true });+ const label = title.locator(".truncate");+ await expect(label).toHaveCSS("text-overflow", "ellipsis");+ expect(await label.evaluate((element) => element.scrollWidth > element.clientWidth)).toBe(true);+ await expect(title).toBeInViewport();+ const check = page.getByRole("tab", { name: /^Check/ });+ const badge = check.locator('span[aria-hidden="true"]').last();+ await expect(badge).toBeVisible();+ // Inflate only the visual count to exercise the largest badge geometry, independently of ATS rules.+ await badge.evaluate((element) => {+ element.textContent = "999";+ });+ const icon = await check.locator('[data-slot="icon"]').boundingBox();+ const count = await badge.boundingBox();+ if (!icon || !count) throw new Error("Missing Check badge geometry");+ expect(count.x).toBeGreaterThanOrEqual(icon.x + icon.width);+ expect((await title.boundingBox())?.x).toBeGreaterThanOrEqual(0);+});+for (const width of [1440, 390]) {test(`formatting toolbar preserves selected text with arrow navigation at ${width}px`, async ({ authPage: page }) => {const created = await page.request.post("/api/openapi/resumes", {@@ -74,6 +99,10 @@ for (const width of [1440, 390]) {await expect(editor).toHaveText("Alpha Beta Gamma");const toolbar = page.getByRole("toolbar", { name: "Formatting" });await editor.focus();+ await page.keyboard.press("Tab");+ await expect(toolbar.getByRole("button", { name: "Bold", exact: true })).toBeFocused();+ await page.keyboard.press("Shift+Tab");+ await expect(editor).toBeFocused();// Keep selectionchange queued until focus has left, as a fast selection followed by Tab can do.await editor.evaluate((element) => {const bold = element.ownerDocument.querySelector<HTMLButtonElement>('[role="toolbar"] button[aria-label="Bold"]');@@ -104,6 +133,35 @@ for (const width of [1440, 390]) {});}+for (const width of [1440, 390]) {+ test(`Tab preserves a selected horizontal rule at ${width}px`, async ({ authPage: page }) => {+ const created = await page.request.post("/api/openapi/resumes", {+ data: { name: "Fictional rule selection", tags: [] },+ });+ await expect(created).toBeOK();+ const id = await created.json();+ await expect(+ await page.request.patch(`/api/openapi/resumes/${id}`, {+ data: { operations: [{ op: "replace", path: "/summary/content", value: "<p>Before</p><hr><p>After</p>" }] },+ }),+ ).toBeOK();+ await page.setViewportSize({ width, height: 900 });+ await page.goto(`/builder/${id}`);+ await page.getByRole("button", { name: "Summary", exact: true }).click();+ const editor = page.getByRole("textbox", { name: "Summary", exact: true });+ await editor.locator("hr").click();+ const selection = () =>+ editor.evaluate((element) => {+ const field = element as HTMLElement & { editor: { state: { selection: { toJSON: () => { type: string } } } } };+ return field.editor.state.selection.toJSON().type;+ });+ await expect.poll(selection).toBe("node");+ await page.keyboard.press("Tab");+ await expect(page.getByRole("toolbar").getByRole("button", { name: "Bold", exact: true })).toBeFocused();+ expect(await selection()).toBe("node");+ });+}+test("phone hero keeps decorative Latin punctuation isolated in Arabic", async ({ page }, info) => {await page.setViewportSize({ width: 390, height: 844 });await page.goto("/?locale=ar-SA");@@ -130,3 +188,19 @@ test("deleting a URL-open application returns to the heading when no row surviveawait expect(sheet).toBeHidden();await expect(page.getByRole("heading", { name: "Applications", exact: true })).toBeFocused();});++test("deleting an application focuses the remaining visible row", async ({ authPage: page }) => {+ for (const role of ["Delete this job", "Keep this job"]) {+ await expect(+ await page.request.post("/api/openapi/applications", { data: { role, company: "Fictional Workshop" } }),+ ).toBeOK();+ }+ await page.goto("/dashboard/applications");+ await page.locator("[data-application-open]").filter({ hasText: "Delete this job" }).click();+ const sheet = page.getByRole("dialog", { name: "Delete this job", exact: true });+ await sheet.getByRole("button", { name: "Application options", exact: true }).click();+ await page.getByRole("menuitem", { name: "Move to Trash", exact: true }).click();+ await page.getByRole("alertdialog").getByRole("button", { name: "Move to Trash", exact: true }).click();+ await expect(sheet).toBeHidden();+ await expect(page.locator("[data-application-open]").filter({ hasText: "Keep this job" })).toBeFocused();+});