Skip to content

armgit / Handy

Public Imported from GitHub
0

A free, open source, and extensible speech-to-text application that works completely offline.

fix: horizontal overflow in onboarding views (#2050)

Nahian1cd926628057
diff --git a/src/App.css b/src/App.css
index bbc8a9b5..c1cf943c 100644
--- a/src/App.css
+++ b/src/App.css
@@ -61,10 +61,17 @@
}
}
+/* Keep onboarding centered when classic scrollbars consume layout space.
+ Overlay scrollbars do not reserve a gutter, so this has no effect on them. */
+:root[data-onboarding-active] {
+ scrollbar-gutter: stable both-edges;
+}
+
/* macOS - tint native overlay scrollbar thumb */
:root[data-platform="macos"] {
scrollbar-color: var(--scrollbar-thumb) transparent;
}
+
/* Custom Scrollbar */
::-webkit-scrollbar {
width: 14px;
diff --git a/src/App.tsx b/src/App.tsx
index 1d23ff59..a25dbc6d 100644
--- a/src/App.tsx
+++ b/src/App.tsx
@@ -1,4 +1,10 @@
-import { useEffect, useState, useRef, type ReactNode } from "react";
+import {
+ useEffect,
+ useLayoutEffect,
+ useState,
+ useRef,
+ type ReactNode,
+} from "react";
import { toast, Toaster } from "sonner";
import { useTranslation } from "react-i18next";
import { listen } from "@tauri-apps/api/event";
@@ -64,6 +70,19 @@ function App() {
(state) => state.refreshOutputDevices,
);
const hasCompletedPostOnboardingInit = useRef(false);
+ const isShowingOnboarding =
+ onboardingPreview !== null ||
+ onboardingStep === "accessibility" ||
+ onboardingStep === "model";
+
+ // Classic scrollbars consume layout space. Reserve a matching gutter on the
+ // opposite edge while onboarding is visible so its content stays centered in
+ // the physical window. Overlay scrollbars ignore scrollbar-gutter.
+ useLayoutEffect(() => {
+ const attribute = "data-onboarding-active";
+ document.documentElement.toggleAttribute(attribute, isShowingOnboarding);
+ return () => document.documentElement.removeAttribute(attribute);
+ }, [isShowingOnboarding]);
useEffect(() => {
checkOnboardingStatus();
diff --git a/src/components/onboarding/AccessibilityOnboarding.tsx b/src/components/onboarding/AccessibilityOnboarding.tsx
index 9b5c30bc..92f952ce 100644
--- a/src/components/onboarding/AccessibilityOnboarding.tsx
+++ b/src/components/onboarding/AccessibilityOnboarding.tsx
@@ -300,7 +300,7 @@ const AccessibilityOnboarding: React.FC<AccessibilityOnboardingProps> = ({
// Still checking platform/initial permissions
if (isChecking) {
return (
- <div className="h-screen w-screen flex items-center justify-center">
+ <div className="h-screen w-full flex items-center justify-center">
<Loader2 className="w-8 h-8 animate-spin text-text/50" />
</div>
);
@@ -309,7 +309,7 @@ const AccessibilityOnboarding: React.FC<AccessibilityOnboardingProps> = ({
// All permissions granted - show success briefly
if (allGranted) {
return (
- <div className="h-screen w-screen flex flex-col items-center justify-center gap-4">
+ <div className="h-screen w-full flex flex-col items-center justify-center gap-4">
<div className="p-4 rounded-full bg-emerald-500/20">
<Check className="w-12 h-12 text-emerald-400" />
</div>
@@ -322,7 +322,7 @@ const AccessibilityOnboarding: React.FC<AccessibilityOnboardingProps> = ({
// Show permissions request screen
return (
- <div className="h-screen w-screen flex flex-col p-6 gap-6 items-center justify-center">
+ <div className="h-screen w-full flex flex-col p-6 gap-6 items-center justify-center">
<div className="flex flex-col items-center gap-2">
<HandyTextLogo width={200} />
</div>
diff --git a/src/components/onboarding/Onboarding.tsx b/src/components/onboarding/Onboarding.tsx
index f6dc0e28..bfaf137e 100644
--- a/src/components/onboarding/Onboarding.tsx
+++ b/src/components/onboarding/Onboarding.tsx
@@ -160,7 +160,7 @@ const Onboarding: React.FC<OnboardingProps> = ({
};
return (
- <div className="h-screen w-screen flex flex-col p-6 gap-4 inset-0">
+ <div className="h-screen w-full flex flex-col p-6 gap-4">
<div className="flex flex-col items-center gap-2 shrink-0">
<HandyTextLogo width={200} />
<p className="text-text/70 max-w-md font-medium mx-auto">