@salesforce/templates 66.17.1 → 66.17.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (103) hide show
  1. package/lib/templates/project/angularextapp/CHANGELOG.md +161 -0
  2. package/lib/templates/project/angularextapp/README.md +110 -44
  3. package/lib/templates/project/angularextapp/_p_/_m_/_w_/_a_/README.md +1 -1
  4. package/lib/templates/project/angularextapp/_p_/_m_/_w_/_a_/package-lock.json +649 -1097
  5. package/lib/templates/project/angularextapp/_p_/_m_/_w_/_a_/package.json +4 -4
  6. package/lib/templates/project/angularextapp/_p_/_m_/_w_/_a_/src/app/_f_/_os_/api/object-search.service.ts +3 -6
  7. package/lib/templates/project/angularextapp/_p_/_m_/_w_/_a_/src/app/_f_/authentication/social-login/social-login.html +39 -0
  8. package/lib/templates/project/angularextapp/_p_/_m_/_w_/_a_/src/app/_f_/authentication/social-login/social-login.ts +107 -0
  9. package/lib/templates/project/angularextapp/_p_/_m_/_w_/_a_/src/app/api/graphql-operations-types.ts +1 -2
  10. package/lib/templates/project/angularextapp/_p_/_m_/_w_/_a_/src/app/components/ui/button/button.ts +1 -8
  11. package/lib/templates/project/angularextapp/_p_/_m_/_w_/_a_/src/app/components/ui/dialog/dialog.html +1 -1
  12. package/lib/templates/project/angularextapp/_p_/_m_/_w_/_a_/src/app/components/ui/icon/icon.ts +6 -0
  13. package/lib/templates/project/angularextapp/_p_/_m_/_w_/_a_/src/app/pages/login/login-page.html +2 -0
  14. package/lib/templates/project/angularextapp/_p_/_m_/_w_/_a_/src/app/pages/login/login-page.ts +2 -1
  15. package/lib/templates/project/angularextapp/_p_/_m_/classes/UIBundleSocialLoginConfig.cls +145 -0
  16. package/lib/templates/project/angularextapp/_p_/_m_/classes/UIBundleSocialLoginConfig.cls-meta.xml +5 -0
  17. package/lib/templates/project/angularextapp/_p_/_m_/classes/UIBundleSocialLoginConfig_Test.cls +181 -0
  18. package/lib/templates/project/angularextapp/_p_/_m_/classes/UIBundleSocialLoginConfig_Test.cls-meta.xml +5 -0
  19. package/lib/templates/project/angularextapp/package.json +1 -1
  20. package/lib/templates/project/angularextapp/scripts/network-senders.mjs +84 -0
  21. package/lib/templates/project/angularextapp/scripts/org-setup-xml.mjs +11 -6
  22. package/lib/templates/project/angularextapp/scripts/org-setup.mjs +13 -5
  23. package/lib/templates/project/angularintapp/_p_/_m_/_w_/_a_/package-lock.json +648 -1096
  24. package/lib/templates/project/reactexternalapp/CHANGELOG.md +129 -0
  25. package/lib/templates/project/reactexternalapp/_p_/_m_/_w_/_a_/package-lock.json +543 -531
  26. package/lib/templates/project/reactexternalapp/_p_/_m_/_w_/_a_/package.json +6 -6
  27. package/lib/templates/project/reactexternalapp/_p_/_m_/_w_/_a_/src/_f_/authentication/forms/auth-form.tsx +14 -2
  28. package/lib/templates/project/reactexternalapp/_p_/_m_/_w_/_a_/src/_f_/authentication/hooks/form.tsx +12 -3
  29. package/lib/templates/project/reactexternalapp/_p_/_m_/_w_/_a_/src/_f_/authentication/layouts/privateRouteLayout.tsx +1 -1
  30. package/lib/templates/project/reactexternalapp/_p_/_m_/_w_/_a_/src/_f_/authentication/menu/AuthMenu.tsx +43 -5
  31. package/lib/templates/project/reactexternalapp/_p_/_m_/_w_/_a_/src/_f_/authentication/pages/ChangePassword.tsx +1 -1
  32. package/lib/templates/project/reactexternalapp/_p_/_m_/_w_/_a_/src/_f_/authentication/pages/ForgotPassword.tsx +8 -4
  33. package/lib/templates/project/reactexternalapp/_p_/_m_/_w_/_a_/src/_f_/authentication/pages/Login.tsx +1 -1
  34. package/lib/templates/project/reactexternalapp/_p_/_m_/_w_/_a_/src/_f_/authentication/pages/Register.tsx +1 -1
  35. package/lib/templates/project/reactexternalapp/_p_/_m_/_w_/_a_/src/_f_/authentication/pages/ResetPassword.tsx +2 -1
  36. package/lib/templates/project/reactexternalapp/_p_/_m_/_w_/_a_/src/_f_/authentication/sessionTimeout/SessionTimeoutValidator.tsx +32 -9
  37. package/lib/templates/project/reactexternalapp/_p_/_m_/_w_/_a_/src/_f_/search/adapters/sobject/parseResponse.ts +1 -2
  38. package/lib/templates/project/reactexternalapp/_p_/_m_/_w_/_a_/src/_f_/search/api/distinctValuesService.ts +3 -6
  39. package/lib/templates/project/reactexternalapp/_p_/_m_/_w_/_a_/src/_f_/search/components/MergedSearchResults.tsx +4 -4
  40. package/lib/templates/project/reactexternalapp/_p_/_m_/_w_/_a_/src/_f_/search/components/Search.tsx +5 -2
  41. package/lib/templates/project/reactexternalapp/_p_/_m_/_w_/_a_/src/_f_/search/components/SourceSection.tsx +5 -4
  42. package/lib/templates/project/reactexternalapp/_p_/_m_/_w_/_a_/src/_f_/search/components/controls/PaginationControls.tsx +5 -6
  43. package/lib/templates/project/reactexternalapp/_p_/_m_/_w_/_a_/src/_f_/search/components/controls/SearchBar.tsx +4 -1
  44. package/lib/templates/project/reactexternalapp/_p_/_m_/_w_/_a_/src/_f_/search/components/results/CmsResultRow.tsx +52 -5
  45. package/lib/templates/project/reactexternalapp/_p_/_m_/_w_/_a_/src/_f_/search/components/results/DefaultResultRow.tsx +4 -1
  46. package/lib/templates/project/reactexternalapp/_p_/_m_/_w_/_a_/src/_f_/search/types.ts +1 -3
  47. package/lib/templates/project/reactexternalapp/_p_/_m_/_w_/_a_/src/appLayout.tsx +13 -4
  48. package/lib/templates/project/reactexternalapp/_p_/_m_/_w_/_a_/src/components/alerts/status-alert.tsx +1 -1
  49. package/lib/templates/project/reactexternalapp/_p_/_m_/_w_/_a_/src/components/ui/alert.tsx +1 -1
  50. package/lib/templates/project/reactexternalapp/_p_/_m_/_w_/_a_/src/components/ui/button.tsx +2 -2
  51. package/lib/templates/project/reactexternalapp/_p_/_m_/_w_/_a_/src/components/ui/checkbox.tsx +1 -1
  52. package/lib/templates/project/reactexternalapp/_p_/_m_/_w_/_a_/src/components/ui/input.tsx +1 -1
  53. package/lib/templates/project/reactexternalapp/_p_/_m_/_w_/_a_/src/components/ui/select.tsx +1 -1
  54. package/lib/templates/project/reactexternalapp/_p_/_m_/_w_/_a_/src/pages/AccountObjectDetailPage.tsx +34 -17
  55. package/lib/templates/project/reactexternalapp/_p_/_m_/_w_/_a_/src/pages/NotFound.tsx +22 -15
  56. package/lib/templates/project/reactexternalapp/_p_/_m_/_w_/_a_/src/routes.tsx +1 -0
  57. package/lib/templates/project/reactexternalapp/_p_/_m_/_w_/_a_/src/styles/global.css +2 -2
  58. package/lib/templates/project/reactexternalapp/_p_/_m_/_w_/_a_/tsconfig.tsbuildinfo +1 -1
  59. package/lib/templates/project/reactexternalapp/package.json +1 -1
  60. package/lib/templates/project/reactexternalapp/scripts/network-senders.mjs +84 -0
  61. package/lib/templates/project/reactexternalapp/scripts/org-setup-xml.mjs +11 -6
  62. package/lib/templates/project/reactexternalapp/scripts/org-setup.mjs +13 -5
  63. package/lib/templates/project/reactinternalapp/CHANGELOG.md +129 -0
  64. package/lib/templates/project/reactinternalapp/_p_/_m_/_w_/_a_/package-lock.json +546 -534
  65. package/lib/templates/project/reactinternalapp/_p_/_m_/_w_/_a_/package.json +6 -6
  66. package/lib/templates/project/reactinternalapp/_p_/_m_/_w_/_a_/src/_f_/search/adapters/sobject/parseResponse.ts +1 -2
  67. package/lib/templates/project/reactinternalapp/_p_/_m_/_w_/_a_/src/_f_/search/api/distinctValuesService.ts +3 -6
  68. package/lib/templates/project/reactinternalapp/_p_/_m_/_w_/_a_/src/_f_/search/components/MergedSearchResults.tsx +4 -4
  69. package/lib/templates/project/reactinternalapp/_p_/_m_/_w_/_a_/src/_f_/search/components/Search.tsx +5 -2
  70. package/lib/templates/project/reactinternalapp/_p_/_m_/_w_/_a_/src/_f_/search/components/SourceSection.tsx +5 -4
  71. package/lib/templates/project/reactinternalapp/_p_/_m_/_w_/_a_/src/_f_/search/components/controls/PaginationControls.tsx +5 -6
  72. package/lib/templates/project/reactinternalapp/_p_/_m_/_w_/_a_/src/_f_/search/components/controls/SearchBar.tsx +4 -1
  73. package/lib/templates/project/reactinternalapp/_p_/_m_/_w_/_a_/src/_f_/search/components/results/CmsResultRow.tsx +52 -5
  74. package/lib/templates/project/reactinternalapp/_p_/_m_/_w_/_a_/src/_f_/search/components/results/DefaultResultRow.tsx +4 -1
  75. package/lib/templates/project/reactinternalapp/_p_/_m_/_w_/_a_/src/_f_/search/types.ts +1 -3
  76. package/lib/templates/project/reactinternalapp/_p_/_m_/_w_/_a_/src/appLayout.tsx +10 -4
  77. package/lib/templates/project/reactinternalapp/_p_/_m_/_w_/_a_/src/components/alerts/status-alert.tsx +1 -1
  78. package/lib/templates/project/reactinternalapp/_p_/_m_/_w_/_a_/src/components/ui/alert.tsx +1 -1
  79. package/lib/templates/project/reactinternalapp/_p_/_m_/_w_/_a_/src/components/ui/button.tsx +2 -2
  80. package/lib/templates/project/reactinternalapp/_p_/_m_/_w_/_a_/src/components/ui/checkbox.tsx +1 -1
  81. package/lib/templates/project/reactinternalapp/_p_/_m_/_w_/_a_/src/components/ui/input.tsx +1 -1
  82. package/lib/templates/project/reactinternalapp/_p_/_m_/_w_/_a_/src/components/ui/select.tsx +1 -1
  83. package/lib/templates/project/reactinternalapp/_p_/_m_/_w_/_a_/src/pages/AccountObjectDetailPage.tsx +30 -13
  84. package/lib/templates/project/reactinternalapp/_p_/_m_/_w_/_a_/src/pages/NotFound.tsx +22 -15
  85. package/lib/templates/project/reactinternalapp/_p_/_m_/_w_/_a_/src/routes.tsx +1 -0
  86. package/lib/templates/project/reactinternalapp/_p_/_m_/_w_/_a_/src/styles/global.css +2 -2
  87. package/lib/templates/project/reactinternalapp/_p_/_m_/_w_/_a_/tsconfig.tsbuildinfo +1 -1
  88. package/lib/templates/project/reactinternalapp/package.json +1 -1
  89. package/lib/templates/project/reactinternalapp/scripts/network-senders.mjs +84 -0
  90. package/lib/templates/project/reactinternalapp/scripts/org-setup-xml.mjs +11 -6
  91. package/lib/templates/project/reactinternalapp/scripts/org-setup.mjs +13 -5
  92. package/lib/templates/uiBundles/angularbasic/package-lock.json +645 -1093
  93. package/lib/templates/uiBundles/reactbasic/package-lock.json +543 -531
  94. package/lib/templates/uiBundles/reactbasic/package.json +6 -6
  95. package/lib/templates/uiBundles/reactbasic/src/components/alerts/status-alert.tsx +1 -1
  96. package/lib/templates/uiBundles/reactbasic/src/components/ui/alert.tsx +1 -1
  97. package/lib/templates/uiBundles/reactbasic/src/components/ui/button.tsx +2 -2
  98. package/lib/templates/uiBundles/reactbasic/src/components/ui/checkbox.tsx +1 -1
  99. package/lib/templates/uiBundles/reactbasic/src/components/ui/input.tsx +1 -1
  100. package/lib/templates/uiBundles/reactbasic/src/components/ui/select.tsx +1 -1
  101. package/lib/templates/uiBundles/reactbasic/src/styles/global.css +2 -2
  102. package/lib/templates/uiBundles/vuebasic/package-lock.json +523 -519
  103. package/package.json +10 -10
@@ -19,8 +19,8 @@
19
19
  "graphql:schema": "node scripts/get-graphql-schema.mjs"
20
20
  },
21
21
  "dependencies": {
22
- "@salesforce/platform-sdk": "^12.4.5",
23
- "@salesforce/ui-bundle": "^12.4.5",
22
+ "@salesforce/platform-sdk": "^12.9.0",
23
+ "@salesforce/ui-bundle": "^12.9.0",
24
24
  "@tailwindcss/vite": "^4.1.17",
25
25
  "class-variance-authority": "^0.7.1",
26
26
  "clsx": "^2.1.1",
@@ -47,8 +47,8 @@
47
47
  "@graphql-eslint/eslint-plugin": "^4.1.0",
48
48
  "@graphql-tools/utils": "^11.0.0",
49
49
  "@playwright/test": "^1.49.0",
50
- "@salesforce/graphiti": "^12.4.5",
51
- "@salesforce/vite-plugin-ui-bundle": "^12.4.5",
50
+ "@salesforce/graphiti": "^12.9.0",
51
+ "@salesforce/vite-plugin-ui-bundle": "^12.9.0",
52
52
  "@testing-library/jest-dom": "^6.6.3",
53
53
  "@testing-library/react": "^16.1.0",
54
54
  "@testing-library/user-event": "^14.5.2",
@@ -56,7 +56,7 @@
56
56
  "@types/react": "^19.2.5",
57
57
  "@types/react-dom": "^19.2.3",
58
58
  "@vitejs/plugin-react": "^5.1.1",
59
- "@vitest/ui": "^4.1.0",
59
+ "@vitest/ui": "^4.1.11",
60
60
  "eslint": "^9.39.1",
61
61
  "eslint-plugin-react": "^7.37.2",
62
62
  "eslint-plugin-react-hooks": "^7.0.1",
@@ -71,7 +71,7 @@
71
71
  "typescript-eslint": "^8.46.4",
72
72
  "vite": "^7.2.4",
73
73
  "vite-plugin-graphql-codegen": "^3.6.3",
74
- "vitest": "^4.1.0"
74
+ "vitest": "^4.1.11"
75
75
  },
76
76
  "overrides": {
77
77
  "lodash": "^4.18.1",
@@ -62,6 +62,7 @@ export function AuthForm({
62
62
 
63
63
  return (
64
64
  <CardLayout title={title} description={description}>
65
+ <h1 className="sr-only">{title}</h1>
65
66
  <div className="space-y-6">
66
67
  {/* [Dev Note] Auth status alert for authenticated users on public pages */}
67
68
  {showAuthAlert && <StatusAlert variant="info">You are already logged in.</StatusAlert>}
@@ -71,10 +72,21 @@ export function AuthForm({
71
72
 
72
73
  <form
73
74
  id={id}
74
- onSubmit={(e) => {
75
+ onSubmit={async (e) => {
75
76
  e.preventDefault();
76
77
  e.stopPropagation();
77
- form.handleSubmit();
78
+ const formElement = e.currentTarget;
79
+ const previousFocus = document.activeElement;
80
+ await form.handleSubmit();
81
+ if (!form.state.isValid) {
82
+ requestAnimationFrame(() => {
83
+ if (formElement.isConnected && document.activeElement === previousFocus) {
84
+ formElement
85
+ .querySelector<HTMLElement>('[aria-invalid="true"]:not(:disabled)')
86
+ ?.focus();
87
+ }
88
+ });
89
+ }
78
90
  }}
79
91
  {...props}
80
92
  >
@@ -1,5 +1,5 @@
1
1
  import { useId } from "react";
2
- import { createFormHookContexts, createFormHook } from "@tanstack/react-form";
2
+ import { createFormHookContexts, createFormHook, useStore } from "@tanstack/react-form";
3
3
  import {
4
4
  Field,
5
5
  FieldDescription,
@@ -40,7 +40,10 @@ function TextField({
40
40
  const id = providedId ?? generatedId;
41
41
  const descriptionId = `${id}-description`;
42
42
  const errorId = `${id}-error`;
43
- const isInvalid = field.state.meta.isBlurred && field.state.meta.errors.length > 0;
43
+ // Submitted fields can be invalid before their first blur.
44
+ const submissionAttempts = useStore(field.form.store, (state) => state.submissionAttempts);
45
+ const isInvalid =
46
+ (field.state.meta.isBlurred || submissionAttempts > 0) && field.state.meta.errors.length > 0;
44
47
 
45
48
  // Deduplicate errors by message
46
49
  const errors = field.state.meta.errors;
@@ -64,7 +67,13 @@ function TextField({
64
67
  aria-describedby={cn(description && descriptionId, isInvalid && errorId)}
65
68
  {...props}
66
69
  />
67
- {isInvalid && uniqueErrors.length > 0 && <FieldError errors={uniqueErrors} />}
70
+ {isInvalid && uniqueErrors.length > 0 && (
71
+ <FieldError
72
+ id={errorId}
73
+ errors={uniqueErrors}
74
+ role={submissionAttempts > 0 ? undefined : "alert"}
75
+ />
76
+ )}
68
77
  </Field>
69
78
  );
70
79
  }
@@ -12,7 +12,7 @@ export default function PrivateRoute() {
12
12
  const { isAuthenticated, loading } = useAuth();
13
13
  const location = useLocation();
14
14
 
15
- if (loading) return null;
15
+ if (loading) return <p role="status">Checking sign-in…</p>;
16
16
 
17
17
  if (!isAuthenticated) {
18
18
  const searchParams = new URLSearchParams();
@@ -1,5 +1,12 @@
1
+ /*
2
+ * Copyright (c) 2024, Salesforce, Inc.
3
+ * All rights reserved.
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+
7
+ import { useEffect, useId, useRef } from "react";
1
8
  import { CircleUser, LogIn, LogOut, UserPen, UserPlus } from "lucide-react";
2
- import { Link } from "react-router";
9
+ import { Link, useLocation } from "react-router";
3
10
  import { useAuth } from "../context/AuthContext";
4
11
  import { ROUTES } from "../authenticationConfig";
5
12
  import { Button } from "../../../components/ui/button";
@@ -31,6 +38,13 @@ export interface AuthMenuProps {
31
38
 
32
39
  export function AuthMenu({ trigger, guestContent, menuItems, className }: AuthMenuProps) {
33
40
  const { user, isAuthenticated, loading, logout } = useAuth();
41
+ const { pathname } = useLocation();
42
+ const userLabelId = useId();
43
+ const openedPathname = useRef(pathname);
44
+ const currentPathname = useRef(pathname);
45
+ useEffect(() => {
46
+ currentPathname.current = pathname;
47
+ }, [pathname]);
34
48
 
35
49
  if (loading) {
36
50
  return <Skeleton className="size-8 rounded-full" />;
@@ -49,14 +63,38 @@ export function AuthMenu({ trigger, guestContent, menuItems, className }: AuthMe
49
63
  const triggerNode = (isAuthenticated && user && trigger?.(user)) || defaultTrigger;
50
64
 
51
65
  return (
52
- <DropdownMenu>
66
+ <DropdownMenu
67
+ onOpenChange={(open) => {
68
+ if (open) openedPathname.current = pathname;
69
+ }}
70
+ >
53
71
  <DropdownMenuTrigger asChild>{triggerNode}</DropdownMenuTrigger>
54
72
 
55
- <DropdownMenuContent align="end" className={className ?? "w-48"}>
73
+ <DropdownMenuContent
74
+ align="end"
75
+ aria-describedby={isAuthenticated ? userLabelId : undefined}
76
+ className={className ?? "w-48"}
77
+ onCloseAutoFocus={(event) => {
78
+ if (openedPathname.current === currentPathname.current) return;
79
+ event.preventDefault();
80
+ // Recover page focus intercepted by the closing menu trap.
81
+ const active = document.activeElement;
82
+ if (active && active !== document.body && active.isConnected) return;
83
+ const target =
84
+ document.querySelector<HTMLElement>("main h1, [role='main'] h1") ??
85
+ document.querySelector<HTMLElement>("main, [role='main']");
86
+ if (target) {
87
+ if (!target.hasAttribute("tabindex")) target.setAttribute("tabindex", "-1");
88
+ target.focus();
89
+ }
90
+ }}
91
+ >
56
92
  {isAuthenticated ? (
57
93
  <>
58
- <DropdownMenuLabel className="truncate">{user?.name}</DropdownMenuLabel>
59
- <DropdownMenuSeparator />
94
+ <DropdownMenuLabel id={userLabelId} className="truncate" aria-hidden="true">
95
+ {user?.name}
96
+ </DropdownMenuLabel>
97
+ <DropdownMenuSeparator aria-hidden="true" />
60
98
  <DropdownMenuItem asChild>
61
99
  <Link to={ROUTES.PROFILE.PATH}>
62
100
  <UserPen className="size-4" />
@@ -50,7 +50,7 @@ export default function ChangePassword() {
50
50
  err.errors.length === 1 ? (
51
51
  err.errors[0]
52
52
  ) : (
53
- <ul>
53
+ <ul role="list">
54
54
  {err.errors.map((e, i) => (
55
55
  <li key={i}>{e}</li>
56
56
  ))}
@@ -4,11 +4,15 @@ import { CenteredPageLayout } from "../layout/centered-page-layout";
4
4
  import { AuthForm } from "../forms/auth-form";
5
5
  import { useAppForm } from "../hooks/form";
6
6
  import { createDataSDK } from "@salesforce/platform-sdk";
7
- import { ROUTES, AUTH_PLACEHOLDERS } from "../authenticationConfig";
7
+ import { ROUTES } from "../authenticationConfig";
8
8
  import { ApiError, handleApiResponse } from "../utils/helpers";
9
9
 
10
10
  const forgotPasswordSchema = z.object({
11
- username: z.string().trim().toLowerCase().email("Please enter a valid username"),
11
+ username: z
12
+ .string()
13
+ .trim()
14
+ .toLowerCase()
15
+ .email("Enter your username in email format, for example asmith@example.com"),
12
16
  });
13
17
 
14
18
  export default function ForgotPassword() {
@@ -42,7 +46,7 @@ export default function ForgotPassword() {
42
46
  err.errors.length === 1 ? (
43
47
  err.errors[0]
44
48
  ) : (
45
- <ul>
49
+ <ul role="list">
46
50
  {err.errors.map((e, i) => (
47
51
  <li key={i}>{e}</li>
48
52
  ))}
@@ -75,7 +79,7 @@ export default function ForgotPassword() {
75
79
  {(field) => (
76
80
  <field.TextField
77
81
  label="Username"
78
- placeholder={AUTH_PLACEHOLDERS.USERNAME}
82
+ placeholder="asmith@example.com"
79
83
  autoComplete="username"
80
84
  disabled={success}
81
85
  />
@@ -60,7 +60,7 @@ export default function Login() {
60
60
  err.errors.length === 1 ? (
61
61
  err.errors[0]
62
62
  ) : (
63
- <ul>
63
+ <ul role="list">
64
64
  {err.errors.map((e, i) => (
65
65
  <li key={i}>{e}</li>
66
66
  ))}
@@ -69,7 +69,7 @@ export default function Register() {
69
69
  console.error("Registration failed", err);
70
70
  if (err instanceof ApiError) {
71
71
  setSubmitError(
72
- <ul>
72
+ <ul role="list">
73
73
  {err.errors.map((e, i) => (
74
74
  <li key={i}>{e}</li>
75
75
  ))}
@@ -45,7 +45,7 @@ export default function ResetPassword() {
45
45
  err.errors.length === 1 ? (
46
46
  err.errors[0]
47
47
  ) : (
48
- <ul>
48
+ <ul role="list">
49
49
  {err.errors.map((e, i) => (
50
50
  <li key={i}>{e}</li>
51
51
  ))}
@@ -64,6 +64,7 @@ export default function ResetPassword() {
64
64
  return (
65
65
  <CenteredPageLayout title={ROUTES.RESET_PASSWORD.TITLE}>
66
66
  <CardLayout title="Reset Password">
67
+ <h1 className="sr-only">Reset Password</h1>
67
68
  <StatusAlert>
68
69
  Reset token is invalid or expired.{" "}
69
70
  <Link to={ROUTES.FORGOT_PASSWORD.PATH} className="underline underline-offset-4">
@@ -378,6 +378,7 @@ function SessionWarningModal({
378
378
  onCountdownExpire,
379
379
  }: SessionWarningModalProps) {
380
380
  const continueButtonRef = useRef<HTMLButtonElement>(null);
381
+ const previousFocusRef = useRef<HTMLElement | null>(null);
381
382
 
382
383
  // Countdown timer with accessibility
383
384
  const timer = useCountdownTimer({
@@ -399,13 +400,6 @@ function SessionWarningModal({
399
400
  start();
400
401
  }, [isOpen, timeRemaining, start, stop, reset]);
401
402
 
402
- // Focus the continue button when dialog opens
403
- useEffect(() => {
404
- if (isOpen) {
405
- continueButtonRef.current?.focus();
406
- }
407
- }, [isOpen]);
408
-
409
403
  // Handle "Continue Working" button click
410
404
  const handleContinue = useCallback(() => {
411
405
  stop();
@@ -421,6 +415,30 @@ function SessionWarningModal({
421
415
  return (
422
416
  <Dialog open={isOpen} onOpenChange={() => {}}>
423
417
  <DialogContent
418
+ aria-labelledby="session-warning-title"
419
+ aria-describedby="session-warning-description"
420
+ onOpenAutoFocus={(event) => {
421
+ event.preventDefault();
422
+ previousFocusRef.current =
423
+ document.activeElement instanceof HTMLElement ? document.activeElement : null;
424
+ continueButtonRef.current?.focus();
425
+ }}
426
+ onCloseAutoFocus={(event) => {
427
+ event.preventDefault();
428
+ const previous = previousFocusRef.current;
429
+ previousFocusRef.current = null;
430
+ if (previous?.isConnected && previous !== document.body) {
431
+ previous.focus();
432
+ if (document.activeElement === previous) return;
433
+ }
434
+ const target = document.querySelector<HTMLElement>("main, #main-content");
435
+ if (target) {
436
+ if (target.tabIndex < 0 && !target.hasAttribute("tabindex")) {
437
+ target.setAttribute("tabindex", "-1");
438
+ }
439
+ target.focus();
440
+ }
441
+ }}
424
442
  showCloseButton={false}
425
443
  onEscapeKeyDown={(e) => e.preventDefault()}
426
444
  onPointerDownOutside={(e) => e.preventDefault()}
@@ -454,10 +472,10 @@ function SessionWarningModal({
454
472
  </div>
455
473
 
456
474
  <DialogFooter className="flex gap-4 justify-end">
457
- <Button variant="outline" onClick={handleLogoutClick} tabIndex={2}>
475
+ <Button variant="outline" onClick={handleLogoutClick}>
458
476
  {LABELS.logoutButton}
459
477
  </Button>
460
- <Button variant="default" onClick={handleContinue} tabIndex={1} ref={continueButtonRef}>
478
+ <Button variant="default" onClick={handleContinue} ref={continueButtonRef}>
461
479
  {LABELS.continueButton}
462
480
  </Button>
463
481
  </DialogFooter>
@@ -578,6 +596,11 @@ export default function SessionTimeoutValidator({
578
596
  */
579
597
  const handleDismissAlert = useCallback(() => {
580
598
  setShowExpiredAlert(false);
599
+ const main = document.querySelector<HTMLElement>("main, #main-content");
600
+ if (main) {
601
+ if (!main.hasAttribute("tabindex")) main.setAttribute("tabindex", "-1");
602
+ main.focus();
603
+ }
581
604
  }, []);
582
605
 
583
606
  return (
@@ -31,8 +31,7 @@ export function parseSObjectResponse(
31
31
  request: SourceRequest<SObjectSourceConfig>,
32
32
  ): SourceResult | null {
33
33
  const queryRoot = (root?.uiapi as Record<string, unknown> | undefined)?.query as
34
- | Record<string, RawSourceResult | null | undefined>
35
- | undefined;
34
+ Record<string, RawSourceResult | null | undefined> | undefined;
36
35
 
37
36
  const raw = queryRoot?.[request.source.key];
38
37
  if (raw == null) return null;
@@ -64,18 +64,15 @@ export async function fetchDistinctValues(
64
64
 
65
65
  const root = response.data as Record<string, unknown> | undefined;
66
66
  const aggregate = (root?.uiapi as Record<string, unknown> | undefined)?.aggregate as
67
- | Record<string, unknown>
68
- | undefined;
67
+ Record<string, unknown> | undefined;
69
68
  const objectAgg = aggregate?.[objectName] as
70
- | { edges?: Array<{ node?: { aggregate?: Record<string, unknown> } }> }
71
- | undefined;
69
+ { edges?: Array<{ node?: { aggregate?: Record<string, unknown> } }> } | undefined;
72
70
  const edges = objectAgg?.edges ?? [];
73
71
 
74
72
  return edges
75
73
  .map((edge) => {
76
74
  const field = edge?.node?.aggregate?.[fieldName] as
77
- | { value?: string | null; displayValue?: string | null; label?: string | null }
78
- | undefined;
75
+ { value?: string | null; displayValue?: string | null; label?: string | null } | undefined;
79
76
  const value = field?.value;
80
77
  if (value == null || value === "") return null;
81
78
  return { value, label: field?.label ?? field?.displayValue ?? value };
@@ -137,7 +137,7 @@ export function MergedSearchResults({
137
137
  whole-request/network failure). Shown once, above the grid. */}
138
138
  {error && (
139
139
  <Alert variant="destructive" role="alert">
140
- <AlertCircle />
140
+ <AlertCircle aria-hidden="true" />
141
141
  <AlertTitle>Search failed</AlertTitle>
142
142
  <AlertDescription>{error}</AlertDescription>
143
143
  </Alert>
@@ -151,7 +151,7 @@ export function MergedSearchResults({
151
151
  .filter((c) => !!c.error)
152
152
  .map((c) => (
153
153
  <Alert key={c.config.key} variant="destructive" role="alert">
154
- <AlertCircle />
154
+ <AlertCircle aria-hidden="true" />
155
155
  <AlertTitle>Failed to load {c.config.label}</AlertTitle>
156
156
  <AlertDescription>{c.error}</AlertDescription>
157
157
  </Alert>
@@ -171,14 +171,14 @@ export function MergedSearchResults({
171
171
  <Skeleton key={i} className="h-48 w-full rounded-lg" />
172
172
  ))}
173
173
  </div>
174
- ) : isShortQuery ? (
174
+ ) : error ? null : isShortQuery ? (
175
175
  <p className="py-12 text-center text-sm text-muted-foreground">{shortQueryMessage}</p>
176
176
  ) : mergedResults.length === 0 ? (
177
177
  <p className="py-12 text-center text-sm text-muted-foreground">
178
178
  {emptyMessage ?? "No results found."}
179
179
  </p>
180
180
  ) : (
181
- <ul className={gridClassName}>
181
+ <ul role="list" className={gridClassName}>
182
182
  {mergedResults.map(({ sourceKey, node }, i) => {
183
183
  const source = handle.sources[sourceKey]?.config;
184
184
  if (!source) return null;
@@ -82,6 +82,8 @@ interface SearchProps {
82
82
  /** Optional override for the entire header region. */
83
83
  renderHeader?: (handle: SearchHandle) => ReactNode;
84
84
  className?: string;
85
+ /** Root element tag; use `"main"` when this owns its route's landmark (WCAG 1.3.1). */
86
+ as?: "div" | "main";
85
87
  }
86
88
 
87
89
  export function Search({
@@ -97,6 +99,7 @@ export function Search({
97
99
  allScopeLabel,
98
100
  renderHeader,
99
101
  className,
102
+ as: Root = "div",
100
103
  }: SearchProps) {
101
104
  // Resolve restrictTo to a lockedScope value, surfacing a clear error if
102
105
  // the (kind, key) pair doesn't match any source. Memoize so it's
@@ -136,7 +139,7 @@ export function Search({
136
139
  const showTotalResults = !merged && sourcesInScope >= 2;
137
140
 
138
141
  return (
139
- <div className={`max-w-6xl mx-auto px-4 sm:px-6 lg:px-8 py-6 space-y-6 ${className ?? ""}`}>
142
+ <Root className={`max-w-6xl mx-auto px-4 sm:px-6 lg:px-8 py-6 space-y-6 ${className ?? ""}`}>
140
143
  {renderHeader ? (
141
144
  renderHeader(handle)
142
145
  ) : (
@@ -198,6 +201,6 @@ export function Search({
198
201
  )}
199
202
  </>
200
203
  )}
201
- </div>
204
+ </Root>
202
205
  );
203
206
  }
@@ -152,14 +152,14 @@ export function SourceSection({
152
152
 
153
153
  {error && (
154
154
  <Alert variant="destructive" role="alert">
155
- <AlertCircle />
155
+ <AlertCircle aria-hidden="true" />
156
156
  <AlertTitle>Failed to load {config.label}</AlertTitle>
157
157
  <AlertDescription>{error}</AlertDescription>
158
158
  </Alert>
159
159
  )}
160
160
 
161
161
  {showResults && (
162
- <ul className="divide-y">
162
+ <ul role="list" className="divide-y">
163
163
  {nodes.map((node, i) => (
164
164
  <li key={getNodeKey(node, idField, i)} className="py-3">
165
165
  {renderResult(node)}
@@ -171,9 +171,9 @@ export function SourceSection({
171
171
  {showEmpty && (
172
172
  <div className="flex flex-col items-center justify-center py-10 text-center">
173
173
  {isShortQuery ? (
174
- <Search className="size-10 text-muted-foreground mb-3" />
174
+ <Search aria-hidden="true" className="size-10 text-muted-foreground mb-3" />
175
175
  ) : (
176
- <SearchX className="size-10 text-muted-foreground mb-3" />
176
+ <SearchX aria-hidden="true" className="size-10 text-muted-foreground mb-3" />
177
177
  )}
178
178
  <p className="text-sm text-muted-foreground">
179
179
  {isShortQuery
@@ -195,6 +195,7 @@ export function SourceSection({
195
195
  onPageSizeChange={pagination.setPageSize}
196
196
  disabled={loading || !!error}
197
197
  idPrefix={`page-size-${config.key}`}
198
+ navLabel={`${config.label} pagination`}
198
199
  />
199
200
  </div>
200
201
  </section>
@@ -37,6 +37,8 @@ interface PaginationControlsProps {
37
37
  onGoToPage?: (pageIndex: number) => void;
38
38
  disabled?: boolean;
39
39
  idPrefix?: string;
40
+ /** Accessible name for the pagination `<nav>` landmark; keep it unique per instance (WCAG 1.3.1, landmark-unique). */
41
+ navLabel?: string;
40
42
  }
41
43
 
42
44
  /**
@@ -76,6 +78,7 @@ export function PaginationControls({
76
78
  onGoToPage,
77
79
  disabled = false,
78
80
  idPrefix = "page-size",
81
+ navLabel = "Pagination",
79
82
  }: PaginationControlsProps) {
80
83
  const handlePageSizeChange = (next: string) => {
81
84
  const size = parseInt(next, 10);
@@ -104,11 +107,7 @@ export function PaginationControls({
104
107
  <Label htmlFor={selectId} className="text-sm font-normal whitespace-nowrap">
105
108
  Results per page:
106
109
  </Label>
107
- <Select
108
- value={pageSize.toString()}
109
- onValueChange={handlePageSizeChange}
110
- disabled={disabled}
111
- >
110
+ <Select value={pageSize.toString()} onValueChange={handlePageSizeChange}>
112
111
  <SelectTrigger id={selectId} className="w-16">
113
112
  <SelectValue />
114
113
  </SelectTrigger>
@@ -121,7 +120,7 @@ export function PaginationControls({
121
120
  </SelectContent>
122
121
  </Select>
123
122
  </div>
124
- <Pagination className="w-full mx-0 sm:justify-end">
123
+ <Pagination aria-label={navLabel} className="w-full mx-0 sm:justify-end">
125
124
  <PaginationContent>
126
125
  <PaginationItem>
127
126
  <PaginationPrevious
@@ -38,7 +38,10 @@ export function SearchBar({ value, onChange, placeholder = "Search…", classNam
38
38
 
39
39
  return (
40
40
  <div className={`relative flex-1 ${className ?? ""}`}>
41
- <Search className="absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground" />
41
+ <Search
42
+ aria-hidden="true"
43
+ className="absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"
44
+ />
42
45
  <Input
43
46
  type="text"
44
47
  value={draft}
@@ -20,6 +20,11 @@ import { Link } from "react-router";
20
20
  import type { CmsSourceConfig, CmsSearchItem } from "../../adapters/cms/types";
21
21
  import { formatContentTypeLabel, isValidCmsFqn } from "../../adapters/cms/contentTypeUtils";
22
22
 
23
+ const EM_BLOCK_SPLIT = /(<(?:em)>[\s\S]*?<\/(?:em)>)/g;
24
+ const EM_BLOCK_EXEC = /^<(?:em)>([\s\S]*?)<\/(?:em)>$/;
25
+ const STRAY_TAG = /<\/?[a-zA-Z][^>]*>/g;
26
+ const ROUTE_TOKEN = /:([A-Za-z_][A-Za-z0-9_]*)/g;
27
+
23
28
  /** Formats an ISO date string for display; echoes the raw string on failure. */
24
29
  function formatPublishedDate(dateStr: string): string {
25
30
  const date = new Date(dateStr);
@@ -43,7 +48,7 @@ function resolveRoute(pattern: string, item: CmsSearchItem): string | null {
43
48
  contentType: item.contentType,
44
49
  };
45
50
  let failed = false;
46
- const out = pattern.replace(/:([A-Za-z_][A-Za-z0-9_]*)/g, (_match, token: string) => {
51
+ const out = pattern.replace(ROUTE_TOKEN, (_match, token: string) => {
47
52
  const value = tokens[token];
48
53
  if (value == null || value === "") {
49
54
  failed = true;
@@ -54,6 +59,44 @@ function resolveRoute(pattern: string, item: CmsSearchItem): string | null {
54
59
  return failed ? null : out;
55
60
  }
56
61
 
62
+ /**
63
+ * - Decodes every HTML entity the browser knows (named + numeric).
64
+ * - Runs twice to unwrap the double-encoding CMS search sometimes returns.
65
+ */
66
+ function decodeEntities(input: string): string {
67
+ if (typeof document === "undefined") return input;
68
+ const el = document.createElement("textarea");
69
+ const pass = (s: string) => {
70
+ el.innerHTML = s;
71
+ return el.value;
72
+ };
73
+ return pass(pass(input));
74
+ }
75
+
76
+ /**
77
+ * Parses a snippet that may contain `<em>…</em>` segments and renders it as highlighted text,
78
+ * and strips any other HTML tags so their content renders as plain text.
79
+ */
80
+ function renderHighlightedSnippet(snippet: string): ReactNode[] {
81
+ const decoded = decodeEntities(snippet);
82
+ const parts = decoded.split(EM_BLOCK_SPLIT);
83
+ return parts.map((part, i) => {
84
+ const emphasisMatch = EM_BLOCK_EXEC.exec(part);
85
+ if (emphasisMatch) {
86
+ return (
87
+ <mark key={i} className="bg-yellow-200 dark:bg-yellow-700/60 rounded-sm px-0.5">
88
+ {emphasisMatch[1].replace(STRAY_TAG, "")}
89
+ </mark>
90
+ );
91
+ }
92
+ return part.replace(STRAY_TAG, "");
93
+ });
94
+ }
95
+
96
+ function toPlainText(raw: string): string {
97
+ return decodeEntities(raw).replace(STRAY_TAG, "");
98
+ }
99
+
57
100
  interface CmsResultRowProps {
58
101
  node: unknown;
59
102
  source: CmsSourceConfig;
@@ -71,12 +114,16 @@ export function CmsResultRow({ node, source }: CmsResultRowProps) {
71
114
 
72
115
  const content: ReactNode = (
73
116
  <>
74
- <span className="font-medium">{item.title ?? "—"}</span>
117
+ <span className="font-medium">{item.title ? renderHighlightedSnippet(item.title) : "—"}</span>
75
118
  {item.highlightedSnippet && (
76
- <p className="text-sm text-muted-foreground">{item.highlightedSnippet}</p>
119
+ <p className="text-sm text-neutral-600 dark:text-neutral-300">
120
+ {renderHighlightedSnippet(item.highlightedSnippet)}
121
+ </p>
77
122
  )}
78
123
  {subtitleParts.length > 0 && (
79
- <p className="text-sm text-muted-foreground">{subtitleParts.join(" · ")}</p>
124
+ <p className="text-sm text-neutral-600 dark:text-neutral-300">
125
+ {subtitleParts.join(" · ")}
126
+ </p>
80
127
  )}
81
128
  </>
82
129
  );
@@ -90,7 +137,7 @@ export function CmsResultRow({ node, source }: CmsResultRowProps) {
90
137
  <Link
91
138
  to={href}
92
139
  className="block hover:bg-accent rounded-md px-3 -mx-3 py-1 transition-colors"
93
- aria-label={`View content: ${item.title}`}
140
+ aria-label={`View content: ${item.title ? toPlainText(item.title) : "content"}`}
94
141
  >
95
142
  {content}
96
143
  </Link>
@@ -86,7 +86,9 @@ export function DefaultResultRow({ node, source }: DefaultResultRowProps) {
86
86
  <>
87
87
  <span className="font-medium">{title ?? "—"}</span>
88
88
  {subtitleParts.length > 0 && (
89
- <p className="text-sm text-muted-foreground">{subtitleParts.join(" · ")}</p>
89
+ <p className="text-sm text-neutral-600 dark:text-neutral-300">
90
+ {subtitleParts.join(" · ")}
91
+ </p>
90
92
  )}
91
93
  </>
92
94
  );
@@ -98,6 +100,7 @@ export function DefaultResultRow({ node, source }: DefaultResultRowProps) {
98
100
  <Link
99
101
  to={href}
100
102
  className="block hover:bg-accent rounded-md px-3 -mx-3 py-1 transition-colors"
103
+ aria-label={`View: ${title ?? "result"}`}
101
104
  >
102
105
  {content}
103
106
  </Link>