Skip to content

📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!

Add missing aria labels

Blue Mouseba72e7f98fe9
diff --git a/web/app/pages/Organisations/Settings/People.tsx b/web/app/pages/Organisations/Settings/People.tsx
index 95ebd4421..c5b8d13ae 100644
--- a/web/app/pages/Organisations/Settings/People.tsx
+++ b/web/app/pages/Organisations/Settings/People.tsx
@@ -33,6 +33,8 @@ import { RadioCardGroup } from '~/ui/RadioCardGroup'
import { Text } from '~/ui/Text'
import { isValidEmail } from '~/utils/validator'
+type InviteRole = Exclude<Role, 'owner'>
+
const NoPeople = () => {
const { t } = useTranslation('common')
@@ -199,7 +201,7 @@ const People = ({ organisation }: PeopleProps) => {
const [form, setForm] = useState<{
email: string
- role: Role
+ role: InviteRole
}>({
email: '',
role: 'viewer',
@@ -426,11 +428,11 @@ const People = ({ organisation }: PeopleProps) => {
onChange={handleInput}
error={beenSubmitted ? errors.email : null}
/>
- <RadioCardGroup<'admin' | 'viewer'>
+ <RadioCardGroup<InviteRole>
name='role'
label={t('project.settings.role')}
className='mt-4'
- value={(form.role as 'admin' | 'viewer') || null}
+ value={form.role || null}
onChange={(role) => setForm((prev) => ({ ...prev, role }))}
error={errors.role}
options={[
diff --git a/web/app/pages/Project/View/components/RefreshStatsButton.tsx b/web/app/pages/Project/View/components/RefreshStatsButton.tsx
index 10ebcc2c2..082a37d3f 100644
--- a/web/app/pages/Project/View/components/RefreshStatsButton.tsx
+++ b/web/app/pages/Project/View/components/RefreshStatsButton.tsx
@@ -83,6 +83,8 @@ export const RefreshStatsButton = ({ onRefresh }: RefreshStatsButtonProps) => {
setProgress(0)
try {
await onRefresh(true)
+ } catch (error) {
+ console.error('Manual refresh failed', error)
} finally {
setIsRefreshing(false)
}
diff --git a/web/app/root.tsx b/web/app/root.tsx
index 2f352e7ba..6451720f6 100644
--- a/web/app/root.tsx
+++ b/web/app/root.tsx
@@ -253,6 +253,7 @@ export function ErrorBoundary() {
<span>{error.message}</span>
<br />
<button
+ id='crash-stack-toggle'
type='button'
onClick={() => setCrashStackShown((prev) => !prev)}
aria-expanded={crashStackShown}
@@ -275,6 +276,7 @@ export function ErrorBoundary() {
<span
id='crash-stack'
role='region'
+ aria-labelledby='crash-stack-toggle'
className='text-sm whitespace-pre-line text-gray-600 dark:text-gray-400'
>
{error.stack}
diff --git a/web/app/ui/ProgressRing.tsx b/web/app/ui/ProgressRing.tsx
index 0cec40e24..b87344019 100644
--- a/web/app/ui/ProgressRing.tsx
+++ b/web/app/ui/ProgressRing.tsx
@@ -60,10 +60,10 @@ const ProgressRing = ({
thresholds = DEFAULT_THRESHOLDS,
ariaLabel,
}: ProgressRingProps) => {
- const normalizedValue = useMemo(
- () => Math.min(100, Math.max(0, value)),
- [value],
- )
+ const normalizedValue = useMemo(() => {
+ const safeValue = Number.isFinite(value) ? value : 0
+ return Math.min(100, Math.max(0, safeValue))
+ }, [value])
const { radius, circumference, strokeDashoffset } = useMemo(() => {
const r = (size - strokeWidth) / 2
@@ -83,8 +83,7 @@ const ProgressRing = ({
)
const center = size / 2
- const isFinite = Number.isFinite(normalizedValue)
- const displayValue = isFinite ? Math.floor(normalizedValue) : 0
+ const displayValue = Math.floor(normalizedValue)
return (
<div
@@ -95,7 +94,7 @@ const ProgressRing = ({
role='progressbar'
aria-valuemin={0}
aria-valuemax={100}
- aria-valuenow={isFinite ? displayValue : undefined}
+ aria-valuenow={displayValue}
aria-label={ariaLabel ?? `Progress: ${displayValue}%`}
>
<svg width={size} height={size} className='-rotate-90' aria-hidden='true'>