Skip to content

armgit / ente

Public Imported from GitHub
0

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

Improve skip-link focus and appearance

Anand Baburajan73e7c95221cb
diff --git a/web/apps/space/src/components/SkipLink.tsx b/web/apps/space/src/components/SkipLink.tsx
index d69f0c2507..765e1417ee 100644
--- a/web/apps/space/src/components/SkipLink.tsx
+++ b/web/apps/space/src/components/SkipLink.tsx
@@ -8,20 +8,35 @@ export const SpaceSkipLink = () => (
href="#space-main-content"
onClick={(event) => {
event.preventDefault();
- document.getElementById("space-main-content")?.focus();
+ const content = document.getElementById("space-main-content");
+ if (!content) return;
+
+ content.focus({ preventScroll: true });
+ const { top } = content.getBoundingClientRect();
+ if (top < 0 || top >= window.innerHeight) {
+ content.scrollIntoView({ block: "start" });
+ }
}}
sx={{
bgcolor: spaceText,
borderRadius: "8px",
+ boxShadow: "0 4px 16px #00000040",
color: spaceAppBackgroundColor,
fontFamily: '"Inter Variable", Inter, sans-serif',
fontSize: 14,
fontWeight: 600,
- left: "8px",
+ left: "50%",
p: "12px 16px",
position: "fixed",
+ textDecoration: "none",
top: "calc(env(safe-area-inset-top) + 8px)",
+ transform: "translateX(-50%)",
+ whiteSpace: "nowrap",
zIndex: 1200,
+ "&:focus-visible": {
+ outline: "2px solid #08C225",
+ outlineOffset: 2,
+ },
"&:not(:focus)": visuallyHidden,
}}
>
diff --git a/web/apps/space/src/screens/FriendsScreen.tsx b/web/apps/space/src/screens/FriendsScreen.tsx
index 5b995bcd30..12c8f02cc8 100644
--- a/web/apps/space/src/screens/FriendsScreen.tsx
+++ b/web/apps/space/src/screens/FriendsScreen.tsx
@@ -843,7 +843,12 @@ export const FriendsScreen: React.FC<FriendsScreenProps> = ({
username={username}
/>
- <Box id="space-main-content" tabIndex={-1}>
+ <Box
+ component="section"
+ id="space-main-content"
+ aria-label="Friends"
+ tabIndex={-1}
+ >
{isLoading ? (
<Box
sx={{
diff --git a/web/apps/space/src/screens/HomeScreen.tsx b/web/apps/space/src/screens/HomeScreen.tsx
index 75e388d56e..5ff6112f99 100644
--- a/web/apps/space/src/screens/HomeScreen.tsx
+++ b/web/apps/space/src/screens/HomeScreen.tsx
@@ -2185,7 +2185,9 @@ export const HomeScreen: React.FC<HomeScreenProps> = ({
/>
</SpaceHomeHeader>
<Box
+ component="section"
id="space-main-content"
+ aria-label="Feed"
tabIndex={-1}
sx={{
boxSizing: "border-box",
diff --git a/web/apps/space/src/screens/MessagesScreen.tsx b/web/apps/space/src/screens/MessagesScreen.tsx
index 5f8bdbd31a..3b5a686e67 100644
--- a/web/apps/space/src/screens/MessagesScreen.tsx
+++ b/web/apps/space/src/screens/MessagesScreen.tsx
@@ -2920,7 +2920,12 @@ export const MessagesScreen: React.FC<MessagesScreenProps> = ({
)}
</>
) : (
- <Box id="space-main-content" tabIndex={-1}>
+ <Box
+ component="section"
+ id="space-main-content"
+ aria-label="Messages"
+ tabIndex={-1}
+ >
{isConversationsLoading ? (
<Box
sx={{
diff --git a/web/apps/space/src/screens/ProfileScreen.tsx b/web/apps/space/src/screens/ProfileScreen.tsx
index 0d23ca0a06..e7944aef46 100644
--- a/web/apps/space/src/screens/ProfileScreen.tsx
+++ b/web/apps/space/src/screens/ProfileScreen.tsx
@@ -1202,7 +1202,11 @@ export const ProfileScreen: React.FC<ProfileScreenProps> = ({
)}
{renderHeader()}
<Box
+ component={isPublicProfile ? "div" : "section"}
id={isPublicProfile ? undefined : "space-main-content"}
+ aria-label={
+ isPublicProfile ? undefined : `${displayName}'s profile`
+ }
tabIndex={isPublicProfile ? undefined : -1}
sx={{
alignItems: "center",
diff --git a/web/apps/space/src/screens/SettingsScreen.tsx b/web/apps/space/src/screens/SettingsScreen.tsx
index 3ddce8aafb..662ba17af4 100644
--- a/web/apps/space/src/screens/SettingsScreen.tsx
+++ b/web/apps/space/src/screens/SettingsScreen.tsx
@@ -491,6 +491,7 @@ export const SettingsScreen: React.FC<SettingsScreenProps> = ({
<Box
component="section"
id="space-main-content"
+ aria-label="Settings"
tabIndex={-1}
sx={{
display: "flex",
@@ -723,6 +724,7 @@ export const ChangeNameSettingsScreen: React.FC<
<Box
component="form"
id="space-main-content"
+ aria-label="Change name"
tabIndex={-1}
onSubmit={handleSubmit}
sx={{