Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Improve Space accessibility and message presentation

Anand Baburajan2f18e3f62dd5
diff --git a/web/apps/space/src/components/ActionFeedback.tsx b/web/apps/space/src/components/ActionFeedback.tsx
index 4feb91317f..a393a269f2 100644
--- a/web/apps/space/src/components/ActionFeedback.tsx
+++ b/web/apps/space/src/components/ActionFeedback.tsx
@@ -33,6 +33,7 @@ export const SpaceActionFeedbackIcon: React.FC<
return (
<Box
component="span"
+ aria-hidden
sx={{
display: "grid",
height: size,
diff --git a/web/apps/space/src/components/AuthenticatedFriendProfile.tsx b/web/apps/space/src/components/AuthenticatedFriendProfile.tsx
index c8ab8c7fba..8a9a9500ee 100644
--- a/web/apps/space/src/components/AuthenticatedFriendProfile.tsx
+++ b/web/apps/space/src/components/AuthenticatedFriendProfile.tsx
@@ -34,8 +34,6 @@ export const AuthenticatedFriendProfile: React.FC<
AuthenticatedFriendProfileProps
> = ({ friendSpaceId, username }) => {
const router = useSpaceRouter();
- const initialSection =
- router.query.section == "latest" ? "latest" : undefined;
const { friends, profile, profileLoadError, profileLoadStatus } =
useSpaceAppState();
const [friendProfile, setFriendProfile] =
@@ -148,8 +146,7 @@ export const AuthenticatedFriendProfile: React.FC<
);
}
if (
- (!hadCachedFriendProfileOnMount.current ||
- initialSection == "latest") &&
+ !hadCachedFriendProfileOnMount.current &&
(isProfileLoading || isPostsLoading)
) {
return <SpaceRouteFallback background={spaceAppBackgroundColor} />;
@@ -161,7 +158,6 @@ export const AuthenticatedFriendProfile: React.FC<
<SpacePageMeta themeColor={spaceAppBackgroundColor} />
<ProfileScreen
headerVariant="friend"
- initialSection={initialSection}
isCoverLoading={isProfileLoading}
isNameLoading={isProfileLoading && !immediateFriendProfile}
isPostsLoading={isPostsLoading}
diff --git a/web/apps/space/src/components/LiveStatus.tsx b/web/apps/space/src/components/LiveStatus.tsx
new file mode 100644
index 0000000000..8e2fd9cfa0
--- /dev/null
+++ b/web/apps/space/src/components/LiveStatus.tsx
@@ -0,0 +1,11 @@
+import { Box } from "@mui/material";
+import { visuallyHidden } from "@mui/utils";
+import type React from "react";
+
+export const SpaceLiveStatus: React.FC<React.PropsWithChildren> = ({
+ children,
+}) => (
+ <Box role="status" aria-atomic="true" sx={visuallyHidden}>
+ {children}
+ </Box>
+);
diff --git a/web/apps/space/src/components/OtpInput.tsx b/web/apps/space/src/components/OtpInput.tsx
index e6346fecfb..3a845a6cfb 100644
--- a/web/apps/space/src/components/OtpInput.tsx
+++ b/web/apps/space/src/components/OtpInput.tsx
@@ -8,6 +8,7 @@ const activeFill = "rgba(8, 194, 37, 0.08)";
interface SpaceOtpInputProps {
ariaLabel: string;
+ errorMessageID?: string;
onChange: (value: string) => void;
value: string;
}
@@ -15,7 +16,7 @@ interface SpaceOtpInputProps {
export const SpaceOtpInput = React.forwardRef<
HTMLInputElement,
SpaceOtpInputProps
->(({ ariaLabel, onChange, value }, ref) => {
+>(({ ariaLabel, errorMessageID, onChange, value }, ref) => {
const [activeIndex, setActiveIndex] = React.useState<number | undefined>(
value.length < spaceOTPCodeLength ? value.length : undefined,
);
@@ -174,7 +175,10 @@ export const SpaceOtpInput = React.forwardRef<
component="input"
ref={ref}
aria-label={ariaLabel}
+ aria-describedby={errorMessageID}
+ aria-invalid={Boolean(errorMessageID)}
autoComplete="one-time-code"
+ required
inputMode="numeric"
maxLength={spaceOTPCodeLength}
onBeforeInput={handleBeforeInput}
diff --git a/web/apps/space/src/components/PostReplyControls.tsx b/web/apps/space/src/components/PostReplyControls.tsx
index 4f6d404e73..40d43954e9 100644
--- a/web/apps/space/src/components/PostReplyControls.tsx
+++ b/web/apps/space/src/components/PostReplyControls.tsx
@@ -152,9 +152,7 @@ export const SpacePostReplyControls: React.FC<SpacePostReplyControlsProps> = ({
: replyActionPhase == "done"
? "Reply sent"
: "Send reply"
- : liked
- ? "Unlike photo"
- : "Like photo"
+ : "Like photo"
}
aria-pressed={isReplyMode ? undefined : liked}
aria-disabled={
diff --git a/web/apps/space/src/pages/_app.tsx b/web/apps/space/src/pages/_app.tsx
index 4a54248bf9..01be0a86b1 100644
--- a/web/apps/space/src/pages/_app.tsx
+++ b/web/apps/space/src/pages/_app.tsx
@@ -26,6 +26,7 @@ import {
spaceTextMuted,
} from "styles/colors";
import "styles/globals.css";
+import { spacePageTitle } from "utils/page-titles";
const interFontURL = new URL(
"@fontsource-variable/inter/files/inter-latin-wght-normal.woff2",
@@ -116,7 +117,7 @@ const App: React.FC<AppProps> = ({ Component, pageProps }) => {
storageManager={null}
>
<CustomHead
- title="Ente Space"
+ title={spacePageTitle(router.pathname)}
viewportContent="width=device-width, initial-scale=1, maximum-scale=1"
>
<link
diff --git a/web/apps/space/src/pages/_document.tsx b/web/apps/space/src/pages/_document.tsx
new file mode 100644
index 0000000000..047542916c
--- /dev/null
+++ b/web/apps/space/src/pages/_document.tsx
@@ -0,0 +1,13 @@
+import { Head, Html, Main, NextScript } from "next/document";
+
+export default function Document() {
+ return (
+ <Html lang="en">
+ <Head />
+ <body>
+ <Main />
+ <NextScript />
+ </body>
+ </Html>
+ );
+}
diff --git a/web/apps/space/src/pages/app/profile.tsx b/web/apps/space/src/pages/app/profile.tsx
index 1b051e498e..f9811dae53 100644
--- a/web/apps/space/src/pages/app/profile.tsx
+++ b/web/apps/space/src/pages/app/profile.tsx
@@ -23,8 +23,6 @@ const initialPostLoadingIndicatorDelayMs = 350;
const Page: React.FC = () => {
const router = useSpaceRouter();
- const initialSection =
- router.query.section == "latest" ? "latest" : undefined;
const {
profile,
profileLoadError,
@@ -99,11 +97,7 @@ const Page: React.FC = () => {
return () => window.clearTimeout(timeoutID);
}, [isInitialPostsLoading]);
- if (
- profileLoadStatus != "ready" ||
- !profile ||
- (initialSection == "latest" && isPostsLoading)
- ) {
+ if (profileLoadStatus != "ready" || !profile) {
return (
<SpaceRouteFallback
background={spaceAppBackgroundColor}
@@ -126,7 +120,6 @@ const Page: React.FC = () => {
<SpacePageMeta themeColor={spaceAppBackgroundColor} />
<ProfileScreen
friendsCount={friendsCount}
- initialSection={initialSection}
isPostsLoading={isPostsLoading}
isStatsLoading={isPostsLoading}
postItems={postItems}
diff --git a/web/apps/space/src/screens/CreateAccountScreen.tsx b/web/apps/space/src/screens/CreateAccountScreen.tsx
index c9e7ff3dcc..a8f208519d 100644
--- a/web/apps/space/src/screens/CreateAccountScreen.tsx
+++ b/web/apps/space/src/screens/CreateAccountScreen.tsx
@@ -1,6 +1,7 @@
import { Box } from "@mui/material";
import { SpaceBackIcon } from "components/BackIcon";
import { SpaceButtonSpinner } from "components/ButtonSpinner";
+import { SpaceLiveStatus } from "components/LiveStatus";
import {
estimatePasswordStrength,
type PasswordStrength,
@@ -201,7 +202,15 @@ const TextInput: React.FC<TextInputProps> = ({
>
<Box sx={{ display: "flex", gap: "2px", minWidth: 0 }}>
<Box component="span">{label}</Box>
- {required && <Box sx={{ color: warning }}>*</Box>}
+ {required && (
+ <Box
+ component="span"
+ aria-hidden
+ sx={{ color: warning }}
+ >
+ *
+ </Box>
+ )}
</Box>
{labelAccessory}
</Box>
@@ -248,9 +257,8 @@ const TextInput: React.FC<TextInputProps> = ({
<Box
component="button"
type="button"
- aria-label={
- showPassword ? "Hide password" : "Show password"
- }
+ aria-label="Show password"
+ aria-pressed={showPassword}
onClick={() => setShowPassword((value) => !value)}
sx={{
alignItems: "center",
@@ -346,6 +354,9 @@ export const CreateAccountScreen: React.FC<CreateAccountScreenProps> = ({
placeItems: { xs: "stretch", sm: "start center" },
}}
>
+ <SpaceLiveStatus>
+ {isSubmitting ? "Creating account" : ""}
+ </SpaceLiveStatus>
<Box
sx={{
bgcolor: "transparent",
diff --git a/web/apps/space/src/screens/HomeScreen.tsx b/web/apps/space/src/screens/HomeScreen.tsx
index f45ead3718..ea2b892f53 100644
--- a/web/apps/space/src/screens/HomeScreen.tsx
+++ b/web/apps/space/src/screens/HomeScreen.tsx
@@ -5,6 +5,7 @@ import {
} from "@hugeicons/core-free-icons";
import { HugeiconsIcon } from "@hugeicons/react";
import { Box, Skeleton } from "@mui/material";
+import { visuallyHidden } from "@mui/utils";
import { SpaceActionToast } from "components/ActionToast";
import { SpaceAvatarImage } from "components/AvatarImage";
import { SpaceCaptionText } from "components/CaptionText";
@@ -549,7 +550,7 @@ const FeedLikeButton: React.FC<FeedLikeButtonProps> = ({
<Box
component="button"
type="button"
- aria-label={isLiked ? "Unlike post" : "Like post"}
+ aria-label="Like post"
aria-pressed={isLiked}
onClick={onClick}
sx={{
@@ -2152,6 +2153,11 @@ export const HomeScreen: React.FC<HomeScreenProps> = ({
position: "relative",
}}
>
+ {hasFeedItems && (
+ <Box component="h1" sx={visuallyHidden}>
+ Home
+ </Box>
+ )}
<Box
sx={{
bgcolor: homeBackground,
diff --git a/web/apps/space/src/screens/LoginScreen.tsx b/web/apps/space/src/screens/LoginScreen.tsx
index 5a9fa57580..d49ad8f887 100644
--- a/web/apps/space/src/screens/LoginScreen.tsx
+++ b/web/apps/space/src/screens/LoginScreen.tsx
@@ -1,7 +1,8 @@
import { Box } from "@mui/material";
import { SpaceBackIcon } from "components/BackIcon";
import { SpaceButtonSpinner } from "components/ButtonSpinner";
-import React, { useEffect, useRef, useState } from "react";
+import { SpaceLiveStatus } from "components/LiveStatus";
+import React, { useEffect, useId, useRef, useState } from "react";
import {
spaceAppBackground,
spaceOnAccent,
@@ -36,6 +37,7 @@ interface LoginScreenProps {
}
interface TextInputProps {
+ autoComplete?: string;
autoFocus?: boolean;
inputRef?: React.Ref<HTMLInputElement>;
label: string;
@@ -74,6 +76,7 @@ const EyeIcon: React.FC = () => (
);
const TextInput: React.FC<TextInputProps> = ({
+ autoComplete,
autoFocus,
inputRef,
label,
@@ -84,6 +87,7 @@ const TextInput: React.FC<TextInputProps> = ({
type = "text",
value,
}) => {
+ const inputID = useId();
const [showPassword, setShowPassword] = useState(false);
const internalInputRef = useRef<HTMLInputElement | null>(null);
const isPassword = type == "password";
@@ -112,6 +116,7 @@ const TextInput: React.FC<TextInputProps> = ({
<Box sx={{ width: "100%" }}>
<Box
component="label"
+ htmlFor={inputID}
sx={{
color: textBase,
display: "flex",
@@ -124,7 +129,11 @@ const TextInput: React.FC<TextInputProps> = ({
}}
>
{label}
- {required && <Box sx={{ color: warning }}>*</Box>}
+ {required && (
+ <Box component="span" aria-hidden sx={{ color: warning }}>
+ *
+ </Box>
+ )}
</Box>
<Box
sx={{
@@ -143,11 +152,14 @@ const TextInput: React.FC<TextInputProps> = ({
>
<Box
component="input"
+ id={inputID}
ref={setInputRef}
+ autoComplete={autoComplete}
autoFocus={autoFocus}
onChange={(event) => onChange?.(event.target.value)}
placeholder={placeholder}
readOnly={readOnly}
+ required={required}
type={isPassword && showPassword ? "text" : type}
value={value}
sx={{
@@ -170,9 +182,8 @@ const TextInput: React.FC<TextInputProps> = ({
<Box
component="button"
type="button"
- aria-label={
- showPassword ? "Hide password" : "Show password"
- }
+ aria-label="Show password"
+ aria-pressed={showPassword}
onClick={togglePasswordVisibility}
onPointerDown={(event) => event.preventDefault()}
sx={{
@@ -260,6 +271,7 @@ export const LoginScreen: React.FC<LoginScreenProps> = ({
const [email, setEmail] = useState(initialEmail ?? "");
const [password, setPassword] = useState("");
const passwordInputRef = useRef<HTMLInputElement | null>(null);
+ const continuePointerTypeRef = useRef("");
const appliedInitialEmailRef = useRef<string | undefined>(initialEmail);
useEffect(() => {
@@ -290,21 +302,21 @@ export const LoginScreen: React.FC<LoginScreenProps> = ({
if (canContinue) void onContinue?.({ email, password });
};
- const handleContinuePointerDown: React.PointerEventHandler<
- HTMLButtonElement
- > = (event) => {
- if (event.pointerType != "touch") return;
-
+ const handleSubmit: React.SubmitEventHandler<HTMLFormElement> = (event) => {
event.preventDefault();
submitLogin();
- if (document.activeElement instanceof HTMLElement) {
- document.activeElement.blur();
- }
};
- const handleSubmit: React.SubmitEventHandler<HTMLFormElement> = (event) => {
- event.preventDefault();
- submitLogin();
+ const handleContinueClick: React.MouseEventHandler<HTMLButtonElement> = (
+ event,
+ ) => {
+ if (
+ event.detail > 0 &&
+ continuePointerTypeRef.current == "touch" &&
+ document.activeElement instanceof HTMLElement
+ ) {
+ document.activeElement.blur();
+ }
};
return (
@@ -318,6 +330,9 @@ export const LoginScreen: React.FC<LoginScreenProps> = ({
placeItems: { xs: "stretch", sm: "start center" },
}}
>
+ <SpaceLiveStatus>
+ {isSubmitting ? "Signing in" : ""}
+ </SpaceLiveStatus>
<Box
sx={{
bgcolor: "transparent",
@@ -402,6 +417,7 @@ export const LoginScreen: React.FC<LoginScreenProps> = ({
}}
>
<TextInput
+ autoComplete="username"
label="Email"
onChange={readOnlyEmail ? undefined : setEmail}
placeholder="Enter your email"
@@ -411,6 +427,7 @@ export const LoginScreen: React.FC<LoginScreenProps> = ({
value={email}
/>
<TextInput
+ autoComplete="current-password"
label="Password"
inputRef={passwordInputRef}
onChange={setPassword}
@@ -461,7 +478,10 @@ export const LoginScreen: React.FC<LoginScreenProps> = ({
disabled={!canContinue}
aria-label={isSubmitting ? "Signing in" : undefined}
aria-busy={isSubmitting ? true : undefined}
- onPointerDown={handleContinuePointerDown}
+ onPointerDown={(event) => {
+ continuePointerTypeRef.current = event.pointerType;
+ }}
+ onClick={handleContinueClick}
sx={{
alignItems: "center",
bgcolor: isContinueButtonActive
diff --git a/web/apps/space/src/screens/MessagesScreen.tsx b/web/apps/space/src/screens/MessagesScreen.tsx
index 33b16321cc..d969555050 100644
--- a/web/apps/space/src/screens/MessagesScreen.tsx
+++ b/web/apps/space/src/screens/MessagesScreen.tsx
@@ -16,6 +16,7 @@ import {
Popper,
} from "@mui/material";
import { SpaceAvatarImage } from "components/AvatarImage";
+import { SpaceLiveStatus } from "components/LiveStatus";
import { SpacePostPhotoInput } from "components/PostPhotoInput";
import { SpacePostPhotosBadge } from "components/PostPhotosBadge";
import { SpaceLoadingSpinner } from "components/RouteFallback";
@@ -56,10 +57,9 @@ const outgoingBubble = "#176B2A";
const incomingBubble = spaceSurface;
const outgoingMessageText = "#FFFFFF";
const incomingMessageText = spaceText;
-const outgoingQuoteBubble = "#124F21";
+const outgoingQuoteBubble = "#213425";
const incomingQuoteBubble = spaceSurfaceHover;
const incomingQuoteText = spaceTextMuted;
-const outgoingQuoteText = "#C7E8CE";
const quoteRule = "#666666";
const dangerColor = "#F63A3A";
const composerHeight = 48;
@@ -1184,7 +1184,8 @@ const QuoteFrame: React.FC<{
children: React.ReactNode;
isOwn: boolean;
mb?: string;
-}> = ({ children, isOwn, mb = "8px" }) => (
+ subtle?: boolean;
+}> = ({ children, isOwn, mb = "8px", subtle = false }) => (
<Box
sx={{
alignItems: "stretch",
@@ -1201,7 +1202,7 @@ const QuoteFrame: React.FC<{
aria-hidden
sx={{
alignSelf: "stretch",
- bgcolor: quoteRule,
+ bgcolor: subtle ? "#444444" : quoteRule,
borderRadius: "999px",
flexShrink: 0,
width: 3,
@@ -1223,14 +1224,12 @@ const MessageReplyPreview: React.FC<{
: false;
return (
- <QuoteFrame isOwn={isOwn}>
+ <QuoteFrame isOwn={isOwn} subtle>
<Box
sx={{
- bgcolor: parentIsOwn
- ? outgoingQuoteBubble
- : incomingQuoteBubble,
+ bgcolor: parentIsOwn ? outgoingQuoteBubble : spaceSurface,
borderRadius,
- color: parentIsOwn ? outgoingQuoteText : incomingQuoteText,
+ color: textSecondary,
fontFamily: '"Inter Variable", Inter, sans-serif',
fontSize: 13,
fontWeight: 600,
@@ -1649,11 +1648,6 @@ const MessageBubble: React.FC<{
WebkitTouchCallout: "none",
WebkitUserSelect: "none",
},
- "&:hover": {
- bgcolor: isOwn
- ? outgoingBubble
- : spaceSurfaceHover,
- },
}}
>
<Box
@@ -1749,6 +1743,7 @@ export const MessagesScreen: React.FC<MessagesScreenProps> = ({
const [sendPhase, setSendPhase] = React.useState<"idle" | "sending">(
"idle",
);
+ const [actionStatus, setActionStatus] = React.useState("");
const [isInviteSharing, setIsInviteSharing] = React.useState(false);
const [activityPostsByKey, setActivityPostsByKey] = React.useState<
Record<string, SpaceMessageActivityPost>
@@ -1886,6 +1881,7 @@ export const MessagesScreen: React.FC<MessagesScreenProps> = ({
stickToThreadBottomRef.current = true;
smoothNextMessageScrollRef.current = true;
setSendPhase("sending");
+ setActionStatus("Sending message");
setMessageText("");
setReplyingTo(null);
const sendPromise = repliedMessage
@@ -1894,6 +1890,7 @@ export const MessagesScreen: React.FC<MessagesScreenProps> = ({
void sendPromise
.then(() => {
setSendPhase("idle");
+ setActionStatus("Message sent");
})
.catch((error: unknown) => {
smoothNextMessageScrollRef.current = false;
@@ -1903,6 +1900,9 @@ export const MessagesScreen: React.FC<MessagesScreenProps> = ({
(currentReplyingTo) => currentReplyingTo ?? repliedMessage,
);
setSendPhase("idle");
+ setActionStatus(
+ "Couldn't send message. Your draft has been restored. Try again.",
+ );
});
};
@@ -2191,6 +2191,7 @@ export const MessagesScreen: React.FC<MessagesScreenProps> = ({
return (
<>
+ <SpaceLiveStatus>{actionStatus}</SpaceLiveStatus>
<SpacePostPhotoInput
inputRef={postPhotoInputRef}
onSelect={onPostPhotoSelect}
@@ -2411,6 +2412,12 @@ export const MessagesScreen: React.FC<MessagesScreenProps> = ({
<>
<Box
ref={threadScrollRef}
+ role="log"
+ aria-label={`Messages with ${selectedName}`}
+ aria-busy={
+ isThreadLoading || isThreadRecipientLoading
+ }
+ aria-relevant="additions text"
onScroll={handleThreadScroll}
sx={{
boxSizing: "border-box",
@@ -2624,6 +2631,7 @@ export const MessagesScreen: React.FC<MessagesScreenProps> = ({
}}
>
<MenuList
+ aria-label="Message actions"
autoFocus
onKeyDown={
handleMessageActionsKeyDown
diff --git a/web/apps/space/src/screens/ProfileScreen.tsx b/web/apps/space/src/screens/ProfileScreen.tsx
index 47fde48e47..43c02c4fed 100644
--- a/web/apps/space/src/screens/ProfileScreen.tsx
+++ b/web/apps/space/src/screens/ProfileScreen.tsx
@@ -484,7 +484,6 @@ const ProfilePostTile: React.FC<ProfilePostTileProps> = ({
interface ProfileScreenProps {
friendsCount?: number;
headerVariant?: "friend" | "owner" | "public" | "public-anonymous";
- initialSection?: "latest";
isAddingFriend?: boolean;
showAddingFriendSpinner?: boolean;
isCoverLoading?: boolean;
@@ -528,7 +527,6 @@ interface ProfileScreenProps {
export const ProfileScreen: React.FC<ProfileScreenProps> = ({
friendsCount = 0,
headerVariant = "owner",
- initialSection,
isAddingFriend = false,
isCoverLoading = false,
isNameLoading = false,
@@ -588,7 +586,6 @@ export const ProfileScreen: React.FC<ProfileScreenProps> = ({
const [loadedCoverUrl, setLoadedCoverUrl] = useState<string | null>(null);
const [postGridWidth, setPostGridWidth] = useState(0);
const postGridRef = React.useRef<HTMLDivElement | null>(null);
- const hasScrolledToLatestPost = React.useRef(false);
const postInputRef = React.useRef<HTMLInputElement | null>(null);
const postImageLoadsInFlightRef = React.useRef<
Map<string, Promise<string | undefined>>
@@ -640,23 +637,6 @@ export const ProfileScreen: React.FC<ProfileScreenProps> = ({
observer.observe(grid);
return () => observer.disconnect();
}, [hasProfilePosts]);
- React.useLayoutEffect(() => {
- if (
- initialSection != "latest" ||
- !postGridWidth ||
- hasScrolledToLatestPost.current
- ) {
- return;
- }
- const grid = postGridRef.current;
- if (!grid) return;
-
- window.scrollTo({
- top: window.scrollY + grid.getBoundingClientRect().top - 16,
- behavior: "instant",
- });
- hasScrolledToLatestPost.current = true;
- }, [initialSection, postGridWidth]);
const shouldShowPostLoadingIndicator =
isPostsLoading && (showPostLoadingIndicator ?? true);
const isCoverImageLoading = Boolean(
diff --git a/web/apps/space/src/screens/SetupProfileScreen.tsx b/web/apps/space/src/screens/SetupProfileScreen.tsx
index 2aadab4f00..93f78d062e 100644
--- a/web/apps/space/src/screens/SetupProfileScreen.tsx
+++ b/web/apps/space/src/screens/SetupProfileScreen.tsx
@@ -150,7 +150,7 @@ const TextInput: React.FC<TextInputProps> = ({
>
{label}
{required && (
- <Box component="span" sx={{ color: warning }}>
+ <Box component="span" aria-hidden sx={{ color: warning }}>
*
</Box>
)}
@@ -177,6 +177,7 @@ const TextInput: React.FC<TextInputProps> = ({
id={id}
onChange={(event) => onChange?.(event.target.value)}
placeholder={placeholder}
+ required={required}
type="text"
value={value}
sx={{
diff --git a/web/apps/space/src/screens/VerifyEmailScreen.tsx b/web/apps/space/src/screens/VerifyEmailScreen.tsx
index 6ac03d865d..1b810c0d65 100644
--- a/web/apps/space/src/screens/VerifyEmailScreen.tsx
+++ b/web/apps/space/src/screens/VerifyEmailScreen.tsx
@@ -45,6 +45,7 @@ export const VerifyEmailScreen: React.FC<VerifyEmailScreenProps> = ({
onResendCode,
onVerify,
}) => {
+ const errorMessageID = React.useId();
const initialOTP = sanitizeSpaceOTP(initialCode);
const [otp, setOtp] = useState(initialOTP);
const inputRef = useRef<HTMLInputElement | null>(null);
@@ -227,12 +228,16 @@ export const VerifyEmailScreen: React.FC<VerifyEmailScreenProps> = ({
<Box sx={{ width: "100%" }}>
<SpaceOtpInput
ref={inputRef}
+ errorMessageID={
+ errorMessage ? errorMessageID : undefined
+ }
ariaLabel="Verification code"
onChange={setOtp}
value={otp}
/>
{errorMessage && (
<Box
+ id={errorMessageID}
role="alert"
sx={{
color: warning,
diff --git a/web/apps/space/src/screens/VerifyTwoFactorScreen.tsx b/web/apps/space/src/screens/VerifyTwoFactorScreen.tsx
index be545e1f6e..399c1cb80f 100644
--- a/web/apps/space/src/screens/VerifyTwoFactorScreen.tsx
+++ b/web/apps/space/src/screens/VerifyTwoFactorScreen.tsx
@@ -39,6 +39,7 @@ export const VerifyTwoFactorScreen: React.FC<VerifyTwoFactorScreenProps> = ({
onBack,
onVerify,
}) => {
+ const errorMessageID = React.useId();
const initialOTP = sanitizeSpaceOTP(initialCode);
const [otp, setOtp] = useState(initialOTP);
const inputRef = useRef<HTMLInputElement | null>(null);
@@ -210,12 +211,16 @@ export const VerifyTwoFactorScreen: React.FC<VerifyTwoFactorScreenProps> = ({
<Box sx={{ width: "100%" }}>
<SpaceOtpInput
ref={inputRef}
+ errorMessageID={
+ errorMessage ? errorMessageID : undefined
+ }
ariaLabel="2FA code"
onChange={setOtp}
value={otp}
/>
{errorMessage && (
<Box
+ id={errorMessageID}
role="alert"
sx={{
color: warning,
diff --git a/web/apps/space/src/utils/page-titles.ts b/web/apps/space/src/utils/page-titles.ts
new file mode 100644
index 0000000000..93c4e0031f
--- /dev/null
+++ b/web/apps/space/src/utils/page-titles.ts
@@ -0,0 +1,28 @@
+const pageTitles: Record<string, string> = {
+ "/login": "Login",
+ "/signup": "Create account",
+ "/verify": "Verify email",
+ "/two-factor/verify": "Two-factor verification",
+ "/passkeys/verify": "Verify passkey",
+ "/passkeys/finish": "Complete verification",
+ "/create-profile": "Create profile",
+ "/add-profile-photo": "Add profile photo",
+ "/app": "Home",
+ "/app/friends": "Friends",
+ "/app/messages": "Messages",
+ "/app/messages/[spaceId]": "Conversation",
+ "/app/post": "Create post",
+ "/app/posts/[spaceId]/[postId]": "Post",
+ "/app/profile": "Your profile",
+ "/app/profile/photo": "Profile photo",
+ "/app/profile/cover": "Cover photo",
+ "/app/profile/photo-edit": "Edit profile photo",
+ "/app/profile/cover-edit": "Edit cover photo",
+ "/app/settings": "Settings",
+ "/app/settings/profile/name": "Change name",
+};
+
+export const spacePageTitle = (pathname: string) => {
+ const title = pageTitles[pathname];
+ return title ? `${title} Β· Ente Space` : "Ente Space";
+};