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!

Fix linting issues

Blue Mouse6124c59c470e
diff --git a/backend/apps/cloud/src/experiment/bayesian.ts b/backend/apps/cloud/src/experiment/bayesian.ts
index 93e78b555..4b8ee2124 100644
--- a/backend/apps/cloud/src/experiment/bayesian.ts
+++ b/backend/apps/cloud/src/experiment/bayesian.ts
@@ -57,37 +57,37 @@ function seedFromVariants(
* Then X / (X + Y) ~ Beta(alpha, beta)
*/
function sampleGamma(shape: number, random: RandomFn): number {
- if (shape >= 1) {
- const d = shape - 1 / 3
- const c = 1 / Math.sqrt(9 * d)
-
- while (true) {
- let x: number
- let v: number
-
- do {
- const u1 = Math.max(random(), Number.EPSILON)
- const u2 = random()
- x = Math.sqrt(-2 * Math.log(u1)) * Math.cos(2 * Math.PI * u2)
- v = 1 + c * x
- } while (v <= 0)
-
- v = v * v * v
- const u = random()
-
- if (u < 1 - 0.0331 * x * x * x * x) {
- return d * v
- }
+ if (shape < 1) {
+ const sample = sampleGamma(shape + 1, random)
+ const u = random()
+ return sample * Math.pow(u, 1 / shape)
+ }
- if (Math.log(u) < 0.5 * x * x + d * (1 - v + Math.log(v))) {
- return d * v
- }
+ const d = shape - 1 / 3
+ const c = 1 / Math.sqrt(9 * d)
+
+ while (true) {
+ let x: number
+ let v: number
+
+ do {
+ const u1 = Math.max(random(), Number.EPSILON)
+ const u2 = random()
+ x = Math.sqrt(-2 * Math.log(u1)) * Math.cos(2 * Math.PI * u2)
+ v = 1 + c * x
+ } while (v <= 0)
+
+ v = v * v * v
+ const u = random()
+
+ if (u < 1 - 0.0331 * x * x * x * x) {
+ return d * v
}
- }
- const sample = sampleGamma(shape + 1, random)
- const u = random()
- return sample * Math.pow(u, 1 / shape)
+ if (Math.log(u) < 0.5 * x * x + d * (1 - v + Math.log(v))) {
+ return d * v
+ }
+ }
}
/**
diff --git a/web/app/api/api.server.ts b/web/app/api/api.server.ts
index 10bab7675..597c85713 100644
--- a/web/app/api/api.server.ts
+++ b/web/app/api/api.server.ts
@@ -2396,7 +2396,7 @@ export async function generateSSOAuthURLServer(
export type { SSOHashSuccessResponse, SSOHashResponse } from '~/lib/models/Auth'
-import type { SSOHashSuccessResponse, SSOHashResponse } from '~/lib/models/Auth'
+import type { SSOHashResponse } from '~/lib/models/Auth'
import { Stats } from '~/lib/models/Stats'
export async function getJWTBySSOHashServer(
diff --git a/web/app/components/Footer/index.tsx b/web/app/components/Footer/index.tsx
index 0516c71b4..d1cf32747 100644
--- a/web/app/components/Footer/index.tsx
+++ b/web/app/components/Footer/index.tsx
@@ -861,6 +861,7 @@ const Footer = ({ showDBIPMessage }: FooterProps) => {
url: (
<a
href='https://swetrix.com'
+ aria-label='Open Swetrix website'
target='_blank'
rel='noopener noreferrer'
className='text-indigo-400 hover:text-indigo-300'
diff --git a/web/app/components/pricing/BillingPricing.tsx b/web/app/components/pricing/BillingPricing.tsx
index 55c97913d..97c3f2cf0 100644
--- a/web/app/components/pricing/BillingPricing.tsx
+++ b/web/app/components/pricing/BillingPricing.tsx
@@ -538,6 +538,7 @@ const BillingPricing = ({
mail: (
<a
title={`Email us at ${CONTACT_EMAIL}`}
+ aria-label='Email Swetrix support'
href={`mailto:${CONTACT_EMAIL}`}
className='font-medium underline decoration-dashed hover:decoration-solid'
/>
diff --git a/web/app/components/tools/TechnicalToolRoute.tsx b/web/app/components/tools/TechnicalToolRoute.tsx
index e6e83dd6a..fae7e5f61 100644
--- a/web/app/components/tools/TechnicalToolRoute.tsx
+++ b/web/app/components/tools/TechnicalToolRoute.tsx
@@ -2777,6 +2777,7 @@ function CspGenerator() {
>
<input
type='checkbox'
+ aria-label={toggle.label}
checked={toggle.checked}
onChange={(event) => toggle.onChange(event.target.checked)}
className='size-4 rounded border-gray-300 text-slate-900 focus:ring-slate-900 dark:border-slate-700 dark:bg-slate-950 dark:focus:ring-slate-300'
@@ -3503,6 +3504,7 @@ function GscExportAnalyzer() {
</Text>
<input
type='file'
+ aria-label='Google Search Console CSV'
accept='.csv,text/csv'
onChange={(event) => handleFile(event.target.files?.[0])}
className='mt-2 block w-full rounded-md bg-white px-3 py-2 text-sm text-gray-900 ring-1 ring-gray-300 transition-shadow duration-150 ease-out ring-inset file:mr-3 file:rounded-md file:border-0 file:bg-gray-100 file:px-3 file:py-1.5 file:text-sm file:font-medium file:text-slate-900 hover:ring-gray-400 focus:ring-2 focus:ring-slate-900 focus:outline-hidden dark:bg-slate-950 dark:text-gray-50 dark:ring-slate-700/80 dark:file:bg-slate-800 dark:file:text-slate-100 dark:hover:ring-slate-600 dark:focus:ring-slate-300'
diff --git a/web/app/modals/ViewProjectHotkeys.tsx b/web/app/modals/ViewProjectHotkeys.tsx
index b6f089d2c..4963fcc9a 100644
--- a/web/app/modals/ViewProjectHotkeys.tsx
+++ b/web/app/modals/ViewProjectHotkeys.tsx
@@ -70,8 +70,8 @@ const HotkeysList = ({ title, hotkeys }: HotkeysListProps) => (
<table className='min-w-full divide-y divide-gray-300 dark:divide-gray-700'>
<caption className='sr-only'>{title}</caption>
<thead>
- <tr>
- <th scope='colgroup' colSpan={2} className='pb-2 text-left'>
+ <tr aria-label={title}>
+ <th colSpan={2} className='pb-2 text-left'>
<Text as='span' size='base' weight='semibold'>
{title}
</Text>
diff --git a/web/app/pages/Auth/Signup/InvitationSignup.tsx b/web/app/pages/Auth/Signup/InvitationSignup.tsx
index a4d13147d..a8b256c17 100644
--- a/web/app/pages/Auth/Signup/InvitationSignup.tsx
+++ b/web/app/pages/Auth/Signup/InvitationSignup.tsx
@@ -208,6 +208,7 @@ const InvitationSignup = () => {
db: (
<a
href={HAVE_I_BEEN_PWNED_URL}
+ aria-label='Open Have I Been Pwned'
className='font-medium underline decoration-dashed hover:decoration-solid'
target='_blank'
rel='noreferrer noopener'
diff --git a/web/app/pages/Auth/Signup/Signup.tsx b/web/app/pages/Auth/Signup/Signup.tsx
index db3adfc06..07b2acd4a 100644
--- a/web/app/pages/Auth/Signup/Signup.tsx
+++ b/web/app/pages/Auth/Signup/Signup.tsx
@@ -393,6 +393,7 @@ const Signup = () => {
db: (
<a
href={HAVE_I_BEEN_PWNED_URL}
+ aria-label='Open Have I Been Pwned'
className='font-medium underline decoration-dashed hover:decoration-solid'
target='_blank'
rel='noreferrer noopener'
diff --git a/web/app/pages/Contact/index.tsx b/web/app/pages/Contact/index.tsx
index 8f8d23207..e613a2e79 100644
--- a/web/app/pages/Contact/index.tsx
+++ b/web/app/pages/Contact/index.tsx
@@ -62,18 +62,21 @@ const Contact = () => {
mail: (
<a
href={`mailto:${CONTACT_EMAIL}`}
+ aria-label='Email Swetrix support'
className='font-medium underline decoration-dashed hover:decoration-solid'
/>
),
twitter: (
<a
href={TWITTER_URL}
+ aria-label='Open Swetrix on X'
className='font-medium underline decoration-dashed hover:decoration-solid'
/>
),
discord: (
<a
href={DISCORD_URL}
+ aria-label='Open Swetrix Discord'
className='font-medium underline decoration-dashed hover:decoration-solid'
/>
),
@@ -89,6 +92,7 @@ const Contact = () => {
feedback: (
<button
type='button'
+ aria-label='Open feedback form'
onClick={() => setFeedbackOpen(true)}
className='font-medium underline decoration-dashed hover:decoration-solid'
/>
diff --git a/web/app/pages/ErrorTracking/index.tsx b/web/app/pages/ErrorTracking/index.tsx
index 027309a8c..cc5db8028 100644
--- a/web/app/pages/ErrorTracking/index.tsx
+++ b/web/app/pages/ErrorTracking/index.tsx
@@ -145,6 +145,7 @@ const ErrorTracking = () => {
oneLC: (
<a
href='https://swetrix.com/docs/swetrix-js-reference#trackerrors'
+ aria-label='Open error tracking documentation'
className='font-medium text-red-600 hover:underline dark:text-red-400'
target='_blank'
rel='noopener noreferrer'
diff --git a/web/app/pages/Landings/Marketers.tsx b/web/app/pages/Landings/Marketers.tsx
index b982d69a8..b9b801af2 100644
--- a/web/app/pages/Landings/Marketers.tsx
+++ b/web/app/pages/Landings/Marketers.tsx
@@ -171,6 +171,7 @@ const Marketers = () => {
integrationLink: (
<a
href={INTEGRATIONS_URL}
+ aria-label='Open integrations'
target='_blank'
rel='noopener noreferrer'
className='text-blue-600 hover:underline dark:text-blue-500'
@@ -179,6 +180,7 @@ const Marketers = () => {
discordUrl: (
<a
href={DISCORD_URL}
+ aria-label='Open Swetrix Discord'
target='_blank'
rel='noopener noreferrer'
className='text-blue-600 hover:underline dark:text-blue-500'
diff --git a/web/app/pages/Landings/SmallBusinesses.tsx b/web/app/pages/Landings/SmallBusinesses.tsx
index 09b7f2e63..f7eeec0ce 100644
--- a/web/app/pages/Landings/SmallBusinesses.tsx
+++ b/web/app/pages/Landings/SmallBusinesses.tsx
@@ -172,6 +172,7 @@ const SmallBusinesses = () => {
integrationLink: (
<a
href={INTEGRATIONS_URL}
+ aria-label='Open integrations'
target='_blank'
rel='noopener noreferrer'
className='text-blue-600 hover:underline dark:text-blue-500'
@@ -180,6 +181,7 @@ const SmallBusinesses = () => {
discordUrl: (
<a
href={DISCORD_URL}
+ aria-label='Open Swetrix Discord'
target='_blank'
rel='noopener noreferrer'
className='text-blue-600 hover:underline dark:text-blue-500'
@@ -188,6 +190,7 @@ const SmallBusinesses = () => {
twitterUrl: (
<a
href={TWITTER_URL}
+ aria-label='Open Swetrix on X'
target='_blank'
rel='noopener noreferrer'
className='text-blue-600 hover:underline dark:text-blue-500'
diff --git a/web/app/pages/Landings/Startups.tsx b/web/app/pages/Landings/Startups.tsx
index 2f44af6d2..a0788cb62 100644
--- a/web/app/pages/Landings/Startups.tsx
+++ b/web/app/pages/Landings/Startups.tsx
@@ -171,6 +171,7 @@ const Startups = () => {
integrationLink: (
<a
href={INTEGRATIONS_URL}
+ aria-label='Open integrations'
target='_blank'
rel='noopener noreferrer'
className='text-blue-600 hover:underline dark:text-blue-500'
@@ -179,6 +180,7 @@ const Startups = () => {
discordUrl: (
<a
href={DISCORD_URL}
+ aria-label='Open Swetrix Discord'
target='_blank'
rel='noopener noreferrer'
className='text-blue-600 hover:underline dark:text-blue-500'
diff --git a/web/app/pages/Onboarding/Onboarding.tsx b/web/app/pages/Onboarding/Onboarding.tsx
index 51d0e048f..a1fe7e5af 100644
--- a/web/app/pages/Onboarding/Onboarding.tsx
+++ b/web/app/pages/Onboarding/Onboarding.tsx
@@ -407,6 +407,7 @@ const SetupTrackingStep = ({ project }: { project: Project }) => {
url: (
<a
href={INTEGRATIONS_URL}
+ aria-label='Open integrations'
target='_blank'
rel='noopener noreferrer'
className='font-medium underline decoration-dashed hover:decoration-solid'
diff --git a/web/app/pages/OpenStartup/index.tsx b/web/app/pages/OpenStartup/index.tsx
index 7d76e8fe7..dd8e204f3 100644
--- a/web/app/pages/OpenStartup/index.tsx
+++ b/web/app/pages/OpenStartup/index.tsx
@@ -472,6 +472,7 @@ const OpenStartup = ({ stats }: OpenStartupProps) => {
livedemo: (
<a
href={LIVE_DEMO_URL}
+ aria-label='Open live demo'
target='_blank'
rel='noopener noreferrer'
className='font-medium underline decoration-dashed hover:decoration-solid'
diff --git a/web/app/pages/Organisations/Settings/People.tsx b/web/app/pages/Organisations/Settings/People.tsx
index 2d27de655..a6f489e4e 100644
--- a/web/app/pages/Organisations/Settings/People.tsx
+++ b/web/app/pages/Organisations/Settings/People.tsx
@@ -424,7 +424,7 @@ const People = ({ organisation }: PeopleProps) => {
>
{t('profileSettings.sharedTable.joinedOn')}
</th>
- <th scope='col' />
+ <th scope='col' aria-label='Actions' />
</tr>
</thead>
<tbody className='divide-y divide-gray-200 bg-white dark:divide-slate-800 dark:bg-slate-950'>
diff --git a/web/app/pages/Organisations/Settings/Projects.tsx b/web/app/pages/Organisations/Settings/Projects.tsx
index d500b0103..251fc519e 100644
--- a/web/app/pages/Organisations/Settings/Projects.tsx
+++ b/web/app/pages/Organisations/Settings/Projects.tsx
@@ -106,13 +106,17 @@ const SelectAProject = ({ onSelect }: SelectAProjectProps) => {
(project) => (
<li
key={project.id}
- className='cursor-pointer hover:bg-gray-50 dark:hover:bg-slate-800'
- onClick={() => onSelect(project)}
+ className='hover:bg-gray-50 dark:hover:bg-slate-800'
>
- <div className='flex items-center px-4 py-4 sm:px-6'>
+ <button
+ type='button'
+ aria-label={project.name}
+ onClick={() => onSelect(project)}
+ className='flex w-full cursor-pointer items-center px-4 py-4 text-left sm:px-6'
+ >
<div className='min-w-0 flex-1'>
<Text
- as='p'
+ as='span'
size='sm'
weight='medium'
className='truncate'
@@ -120,7 +124,7 @@ const SelectAProject = ({ onSelect }: SelectAProjectProps) => {
{project.name}
</Text>
</div>
- </div>
+ </button>
</li>
),
)}
@@ -168,6 +172,7 @@ const ProjectList = ({ projects, onRemove }: ProjectListProps) => {
return projects.map((project) => (
<tr
key={project.id}
+ aria-label={project.name}
className='bg-white hover:bg-gray-50 dark:bg-slate-950 dark:hover:bg-slate-900/50'
>
<td className='px-4 py-3 text-sm whitespace-nowrap text-gray-900 dark:text-gray-100'>
@@ -186,7 +191,9 @@ const ProjectList = ({ projects, onRemove }: ProjectListProps) => {
text={t('organisations.projectOwnedBy', {
email: project.admin.email,
})}
- tooltipNode={<InfoIcon className='size-5 text-gray-400' />}
+ tooltipNode={
+ <InfoIcon className='size-5 text-gray-400' aria-hidden='true' />
+ }
/>
) : null}
@@ -387,7 +394,7 @@ export const Projects = ({ organisation }: ProjectsProps) => {
>
{t('common.name')}
</th>
- <th scope='col' />
+ <th scope='col' aria-label='Actions' />
</tr>
</thead>
<tbody className='divide-y divide-gray-200 bg-white dark:divide-slate-800 dark:bg-slate-950'>
diff --git a/web/app/pages/Performance/index.tsx b/web/app/pages/Performance/index.tsx
index bc9c63d28..6e0754d83 100644
--- a/web/app/pages/Performance/index.tsx
+++ b/web/app/pages/Performance/index.tsx
@@ -141,6 +141,7 @@ const Performance = () => {
wpostatsUrl: (
<a
href='https://wpostats.com/?utm_source=swetrix.com'
+ aria-label='Open WPO Stats'
className='font-medium text-orange-600 hover:underline dark:text-orange-400'
target='_blank'
rel='noopener noreferrer'
diff --git a/web/app/pages/Project/Settings/Alerts/ProjectAlertsView.tsx b/web/app/pages/Project/Settings/Alerts/ProjectAlertsView.tsx
index c52df411e..d8f135067 100644
--- a/web/app/pages/Project/Settings/Alerts/ProjectAlertsView.tsx
+++ b/web/app/pages/Project/Settings/Alerts/ProjectAlertsView.tsx
@@ -112,13 +112,14 @@ const AlertRow = ({
return (
<>
- <li
- onClick={() => openAlert(id)}
- className='group relative mb-3 cursor-pointer overflow-hidden rounded-lg border border-gray-200 bg-gray-50 transition-colors hover:bg-gray-100 dark:border-slate-800/60 dark:bg-slate-900/25 dark:hover:bg-slate-900/60'
- >
+ <li className='group relative mb-3 overflow-hidden rounded-lg border border-gray-200 bg-gray-50 transition-colors hover:bg-gray-100 dark:border-slate-800/60 dark:bg-slate-900/25 dark:hover:bg-slate-900/60'>
<div className='flex items-center justify-between gap-4 px-4 py-3 sm:px-5'>
{/* Left section: Icon + Name + Badge */}
- <div className='flex min-w-0 flex-1 items-center gap-3'>
+ <button
+ type='button'
+ onClick={() => openAlert(id)}
+ className='flex min-w-0 flex-1 cursor-pointer items-center gap-3 text-left'
+ >
<div
className={cx(
'flex size-9 shrink-0 items-center justify-center rounded-lg',
@@ -178,7 +179,7 @@ const AlertRow = ({
</Text>
</div>
</div>
- </div>
+ </button>
{/* Right section: Last triggered + Actions */}
<div className='flex shrink-0 items-center gap-3'>
diff --git a/web/app/pages/Project/Settings/Alerts/RichTemplateInput.tsx b/web/app/pages/Project/Settings/Alerts/RichTemplateInput.tsx
index c7f3bf362..7d3e7eb52 100644
--- a/web/app/pages/Project/Settings/Alerts/RichTemplateInput.tsx
+++ b/web/app/pages/Project/Settings/Alerts/RichTemplateInput.tsx
@@ -501,6 +501,7 @@ const RichTemplateInput = forwardRef<
</div>
<textarea
ref={taRef}
+ aria-label={typeof label === 'string' ? label : placeholder || 'Template'}
rows={rows}
value={value}
onChange={onChangeInternal}
@@ -580,7 +581,6 @@ const SuggestionMenu = ({
top: caret.top + caret.lineHeight + 4,
left: caret.left,
}}
- role='listbox'
>
{variables.map((v, i) => (
<button
@@ -591,8 +591,6 @@ const SuggestionMenu = ({
e.preventDefault()
onPick(v.name)
}}
- role='option'
- aria-selected={i === activeIndex}
className={cx(
'flex w-full flex-col items-start gap-0.5 px-3 py-2 text-left transition-colors',
i === activeIndex
diff --git a/web/app/pages/Project/Settings/Annotations.tsx b/web/app/pages/Project/Settings/Annotations.tsx
index 8cc377181..6aeb30aaf 100644
--- a/web/app/pages/Project/Settings/Annotations.tsx
+++ b/web/app/pages/Project/Settings/Annotations.tsx
@@ -221,7 +221,7 @@ const Annotations = ({ projectId, allowedToManage }: AnnotationsProps) => {
>
{t('project.settings.annotations.text')}
</th>
- {allowedToManage ? <th /> : null}
+ {allowedToManage ? <th aria-label='Actions' /> : null}
</tr>
</thead>
<tbody className='divide-y divide-gray-200 bg-white dark:divide-slate-700 dark:bg-slate-950'>
@@ -242,6 +242,7 @@ const Annotations = ({ projectId, allowedToManage }: AnnotationsProps) => {
<button
type='button'
onClick={() => openEditModal(annotation)}
+ aria-label={t('common.edit')}
className='rounded p-1.5 text-gray-500 transition-colors hover:bg-gray-100 hover:text-gray-700 dark:text-gray-400 dark:hover:bg-slate-800 dark:hover:text-gray-200'
title={t('common.edit')}
>
@@ -250,6 +251,7 @@ const Annotations = ({ projectId, allowedToManage }: AnnotationsProps) => {
<button
type='button'
onClick={() => setDeleteAnnotationItem(annotation)}
+ aria-label={t('common.delete')}
className='rounded p-1.5 text-red-500 transition-colors hover:bg-red-50 hover:text-red-700 dark:text-red-400 dark:hover:bg-red-900/20 dark:hover:text-red-300'
title={t('common.delete')}
>
diff --git a/web/app/pages/Project/Settings/Emails/Emails.tsx b/web/app/pages/Project/Settings/Emails/Emails.tsx
index 08b3f79e6..6fffaf904 100644
--- a/web/app/pages/Project/Settings/Emails/Emails.tsx
+++ b/web/app/pages/Project/Settings/Emails/Emails.tsx
@@ -185,42 +185,50 @@ const EmailList = ({ data, onRemove, setEmails }: EmailListProps) => {
className='absolute right-0 z-10 mt-2 w-72 origin-top-right divide-y divide-gray-200 rounded-md bg-white text-left focus:outline-hidden dark:divide-gray-700 dark:bg-slate-950'
>
{_map(reportFrequencyForEmailsOptions, (item, index) => (
- <li
- onClick={() => changeRole(item)}
- className={cx(
- 'group flex cursor-pointer items-center justify-between p-4 hover:bg-indigo-600',
- index === 0 && 'rounded-t-md',
- )}
- key={item.value}
- >
- <div>
- <Text
- as='p'
- weight='bold'
- colour='secondary'
- className='group-hover:text-gray-200'
- >
- {t(`profileSettings.${_toLower(item.label)}`)}
- </Text>
- </div>
- {reportFrequency === item.value ? (
- <span className='text-indigo-600 group-hover:text-gray-200'>
- <CheckIcon className='ml-1 h-7 w-7 pt-px' />
- </span>
- ) : null}
+ <li key={item.value}>
+ <button
+ type='button'
+ onClick={() => changeRole(item)}
+ className={cx(
+ 'group flex w-full cursor-pointer items-center justify-between p-4 text-left hover:bg-indigo-600',
+ index === 0 && 'rounded-t-md',
+ )}
+ >
+ <div>
+ <Text
+ as='span'
+ weight='bold'
+ colour='secondary'
+ className='group-hover:text-gray-200'
+ >
+ {t(`profileSettings.${_toLower(item.label)}`)}
+ </Text>
+ </div>
+ {reportFrequency === item.value ? (
+ <span className='text-indigo-600 group-hover:text-gray-200'>
+ <CheckIcon
+ className='ml-1 h-7 w-7 pt-px'
+ aria-hidden='true'
+ />
+ </span>
+ ) : null}
+ </button>
</li>
))}
- <li
- onClick={onRemove}
- className='group flex cursor-pointer items-center justify-between rounded-b-md p-4 hover:bg-gray-200 dark:hover:bg-gray-700'
- >
- <Text
- as='p'
- weight='bold'
- className='text-red-600 dark:text-red-500'
+ <li>
+ <button
+ type='button'
+ onClick={onRemove}
+ className='group flex w-full cursor-pointer items-center justify-between rounded-b-md p-4 text-left hover:bg-gray-200 dark:hover:bg-gray-700'
>
- {t('project.settings.removeMember')}
- </Text>
+ <Text
+ as='span'
+ weight='bold'
+ className='text-red-600 dark:text-red-500'
+ >
+ {t('project.settings.removeMember')}
+ </Text>
+ </button>
</li>
</ul>
) : null}
@@ -533,7 +541,7 @@ const Emails = ({ projectId }: { projectId: string }) => {
>
{t('auth.common.addedOn')}
</th>
- <th scope='col' />
+ <th scope='col' aria-label='Actions' />
</tr>
</thead>
<tbody className='divide-y divide-gray-200 bg-white dark:divide-slate-800 dark:bg-slate-950'>
diff --git a/web/app/pages/Project/Settings/People/People.tsx b/web/app/pages/Project/Settings/People/People.tsx
index 767c6c114..501cc16af 100644
--- a/web/app/pages/Project/Settings/People/People.tsx
+++ b/web/app/pages/Project/Settings/People/People.tsx
@@ -422,7 +422,7 @@ const People = ({ project }: PeopleProps) => {
>
{t('profileSettings.sharedTable.joinedOn')}
</th>
- <th scope='col' />
+ <th scope='col' aria-label='Actions' />
</tr>
</thead>
<tbody className='divide-y divide-gray-200 bg-white dark:divide-slate-800 dark:bg-slate-950'>
diff --git a/web/app/pages/Project/Settings/ProjectSettings.tsx b/web/app/pages/Project/Settings/ProjectSettings.tsx
index 78f6a8145..73b24cca8 100644
--- a/web/app/pages/Project/Settings/ProjectSettings.tsx
+++ b/web/app/pages/Project/Settings/ProjectSettings.tsx
@@ -197,6 +197,7 @@ const ModalMessage = ({
</Text>
<input
type='text'
+ aria-label='Date range'
className='m-0 h-0 w-0 border-0 p-0 focus:border-transparent focus:text-transparent focus:shadow-none focus:ring-transparent'
/>
<DatePicker
@@ -1483,6 +1484,7 @@ const ProjectSettings = () => {
url: (
<a
href='https://docs.swetrix.com/selfhosting/google-search-console'
+ aria-label='Open Google Search Console self-hosting guide'
target='_blank'
rel='noopener noreferrer'
className='font-medium underline decoration-dashed hover:decoration-solid'
@@ -1602,6 +1604,7 @@ const ProjectSettings = () => {
url: (
<a
href='https://search.google.com/search-console/about'
+ aria-label='Open Google Search Console'
target='_blank'
rel='noopener noreferrer'
className='font-medium underline decoration-dashed hover:decoration-solid'
@@ -1674,6 +1677,7 @@ const ProjectSettings = () => {
url: (
<a
href='https://swetrix.com/docs/captcha/server-side-validation'
+ aria-label='Open CAPTCHA server-side validation guide'
target='_blank'
rel='noopener noreferrer'
className='font-medium underline decoration-dashed hover:decoration-solid'
diff --git a/web/app/pages/Project/Settings/components/DataImportTab.tsx b/web/app/pages/Project/Settings/components/DataImportTab.tsx
index 2a3caeba7..d2cbfe09c 100644
--- a/web/app/pages/Project/Settings/components/DataImportTab.tsx
+++ b/web/app/pages/Project/Settings/components/DataImportTab.tsx
@@ -508,7 +508,7 @@ export default function DataImportTab({ projectId }: DataImportTabProps) {
>
{t('project.settings.dataImport.created')}
</th>
- <th scope='col' />
+ <th scope='col' aria-label='Actions' />
</tr>
</thead>
<tbody className='divide-y divide-gray-200 bg-white dark:divide-slate-800 dark:bg-slate-950'>
@@ -600,6 +600,7 @@ export default function DataImportTab({ projectId }: DataImportTabProps) {
1: (
<a
href='https://swetrix.com/docs/data-import'
+ aria-label='Open data import documentation'
target='_blank'
rel='noreferrer'
className='text-indigo-600 hover:text-indigo-500 dark:text-slate-300 dark:hover:text-white'
diff --git a/web/app/pages/Project/Settings/components/ProxyDomainsTab.tsx b/web/app/pages/Project/Settings/components/ProxyDomainsTab.tsx
index eb74774bd..1577f5f8a 100644
--- a/web/app/pages/Project/Settings/components/ProxyDomainsTab.tsx
+++ b/web/app/pages/Project/Settings/components/ProxyDomainsTab.tsx
@@ -99,13 +99,16 @@ function CopyButton({
value,
className,
title,
+ 'aria-label': ariaLabel,
}: {
value: string
className?: string
title?: string
+ 'aria-label'?: string
}) {
const { t } = useTranslation('common')
const [copied, setCopied] = useState(false)
+ const label = ariaLabel ?? title ?? t('project.settings.proxy.copy')
const onCopy = async (e: React.MouseEvent) => {
e.stopPropagation()
@@ -124,16 +127,17 @@ function CopyButton({
<button
type='button'
onClick={onCopy}
- title={title ?? t('project.settings.proxy.copy')}
+ title={title ?? label}
+ aria-label={label}
className={cx(
'inline-flex items-center justify-center rounded-md text-gray-500 transition-colors hover:bg-gray-100 hover:text-gray-700 dark:text-gray-400 dark:hover:bg-slate-800 dark:hover:text-gray-200',
className,
)}
>
{copied ? (
- <CheckIcon className='size-4 text-emerald-500' />
+ <CheckIcon className='size-4 text-emerald-500' aria-hidden='true' />
) : (
- <CopyIcon className='size-4' />
+ <CopyIcon className='size-4' aria-hidden='true' />
)}
</button>
)
@@ -191,7 +195,7 @@ function DnsRecordTable({ domain }: { domain: ProxyDomain }) {
</tr>
</thead>
<tbody className='divide-y divide-gray-200 bg-white dark:divide-slate-800 dark:bg-slate-950'>
- <tr>
+ <tr aria-label='DNS record'>
<td className='px-3 py-2.5'>
<Text as='span' size='sm' colour='primary' className='font-mono'>
CNAME
@@ -209,6 +213,7 @@ function DnsRecordTable({ domain }: { domain: ProxyDomain }) {
</Text>
<CopyButton
value={domain.hostname}
+ aria-label={t('project.settings.proxy.copy')}
className='size-6 shrink-0'
/>
</div>
@@ -225,6 +230,7 @@ function DnsRecordTable({ domain }: { domain: ProxyDomain }) {
</Text>
<CopyButton
value={domain.proxyTarget}
+ aria-label={t('project.settings.proxy.copy')}
className='size-6 shrink-0'
/>
</div>
diff --git a/web/app/pages/Project/View/Panels.tsx b/web/app/pages/Project/View/Panels.tsx
index 0e83a1783..c235e0d73 100644
--- a/web/app/pages/Project/View/Panels.tsx
+++ b/web/app/pages/Project/View/Panels.tsx
@@ -432,7 +432,8 @@ const KVTable = ({
/>
</th>
<th className='w-[30%] sm:w-1/6'>
- <p
+ <button
+ type='button'
onClick={() => onSortBy('quantity')}
className='flex cursor-pointer items-center justify-end'
>
@@ -446,10 +447,11 @@ const KVTable = ({
sort.label === 'quantity' ? sort.sortByDescend : null
}
/>
- </p>
+ </button>
</th>
<th className='w-[30%] pr-2 sm:w-1/6'>
- <p
+ <button
+ type='button'
onClick={() => onSortBy('conversion')}
className='flex cursor-pointer items-center justify-end'
>
@@ -463,7 +465,7 @@ const KVTable = ({
sort.label === 'conversion' ? sort.sortByDescend : null
}
/>
- </p>
+ </button>
</th>
</tr>
</thead>
@@ -832,7 +834,8 @@ const CustomEvents = ({
/>
</th>
<th className='w-[40%] pr-2 sm:w-2/6'>
- <p
+ <button
+ type='button'
className='flex cursor-pointer items-center justify-end hover:opacity-90'
onClick={() => onSortBy('quantity')}
>
@@ -847,27 +850,19 @@ const CustomEvents = ({
}
/>
&nbsp;&nbsp;
- </p>
+ </button>
</th>
</tr>
</thead>
<tbody>
{_map(keys, (ev) => (
<Fragment key={ev}>
- <tr
- className='group cursor-pointer text-base text-gray-900 transition-colors even:bg-gray-50 hover:bg-gray-100 dark:text-gray-50 dark:even:bg-slate-900 hover:dark:bg-slate-800'
- onClick={(e) => {
- e.preventDefault()
- e.stopPropagation()
- const link = _getFilterLink(null, ev)
- navigate(link)
- setTriggerEventWhenFiltersChange(ev)
- }}
- >
+ <tr className='group text-base text-gray-900 transition-colors even:bg-gray-50 hover:bg-gray-100 dark:text-gray-50 dark:even:bg-slate-900 hover:dark:bg-slate-800'>
<td className='flex items-center py-1 text-left'>
<button
className='peer z-10 -m-1 ml-1 rounded-md border border-transparent p-1 transition-colors hover:border-gray-200 hover:bg-white hover:dark:border-slate-700/80 dark:hover:bg-slate-900 dark:focus:ring-slate-300'
type='button'
+ aria-label={`${activeEvents[ev] ? 'Hide' : 'Show'} ${ev} details`}
onClick={toggleDetails(ev)}
>
{loadingEvents[ev] ? (
@@ -878,11 +873,25 @@ const CustomEvents = ({
<CaretDownIcon className='size-5 text-gray-500 dark:text-gray-300' />
)}
</button>
- <span className='pl-2'>{ev}</span>
- <FunnelIcon className='ml-2 hidden h-4 w-4 shrink-0 text-gray-500 group-hover:block peer-hover:hidden dark:text-gray-300' />
- <div className='ml-2 h-4 w-4 group-hover:hidden peer-hover:block' />
+ <button
+ type='button'
+ aria-label={`${ev} filters`}
+ onClick={() => {
+ const link = _getFilterLink(null, ev)
+ navigate(link)
+ setTriggerEventWhenFiltersChange(ev)
+ }}
+ className='flex min-w-0 cursor-pointer items-center pl-2 text-left'
+ >
+ <span>{ev}</span>
+ <FunnelIcon className='ml-2 hidden h-4 w-4 shrink-0 text-gray-500 group-hover:block peer-hover:hidden dark:text-gray-300' />
+ <span className='ml-2 h-4 w-4 group-hover:hidden peer-hover:block' />
+ </button>
</td>
- <td className='w-[40%] py-1 pr-2 text-right sm:w-2/6'>
+ <td
+ aria-label={`${ev} total`}
+ className='w-[40%] py-1 pr-2 text-right sm:w-2/6'
+ >
<span className='inline-flex items-center justify-end'>
<Text size='sm' weight='medium'>
{eventsData[ev]}
@@ -1988,13 +1997,11 @@ const DetailsTable = ({
<div
className='sticky top-0 z-10 grid bg-white text-sm font-semibold text-gray-900 sm:text-base dark:bg-slate-950 dark:text-gray-50'
style={{ gridTemplateColumns }}
- role='row'
>
<button
type='button'
className='flex cursor-pointer items-center py-1 pl-2 text-left hover:opacity-90'
onClick={() => onSortBy('name')}
- role='columnheader'
>
<span className='truncate'>
{tnMapping[activeTabId as keyof typeof tnMapping]}
@@ -2011,7 +2018,6 @@ const DetailsTable = ({
type='button'
className='flex cursor-pointer items-center justify-end py-1 pr-2 text-right hover:opacity-90'
onClick={() => onSortBy('quantity')}
- role='columnheader'
>
<span className='truncate'>
{valuesHeaderName || t('project.visitors')}
@@ -2032,7 +2038,6 @@ const DetailsTable = ({
type='button'
className='flex cursor-pointer items-center justify-end py-1 pr-2 text-right hover:opacity-90'
onClick={() => onSortBy(col.sortLabel)}
- role='columnheader'
>
<span className='truncate'>{col.header}</span>
<Sort
@@ -2047,10 +2052,7 @@ const DetailsTable = ({
</button>
))}
{!hidePercentageInDetails ? (
- <div
- className='flex items-center justify-end py-1 pr-2 text-right'
- role='columnheader'
- >
+ <div className='flex items-center justify-end py-1 pr-2 text-right'>
<span className='truncate'>{t('project.percentage')}</span>
</div>
) : null}
@@ -2072,35 +2074,32 @@ const DetailsTable = ({
const valueData = valueMapper(count)
const isOddRow = virtualRow.index % 2 === 1
-
- return (
- <div
- key={`${id}-${entryName}-${Object.values(rest).join('-')}`}
- style={{
- position: 'absolute',
- top: 0,
- transform: `translateY(${virtualRow.start}px)`,
- width: '100%',
- height: `${virtualRow.size}px`,
- gridTemplateColumns,
- }}
- className={cx(
- 'group grid cursor-pointer items-center text-sm text-gray-900 hover:bg-gray-100 sm:text-base dark:text-gray-50 hover:dark:bg-slate-800',
- {
- 'bg-gray-50 dark:bg-slate-900': isOddRow,
- 'cursor-default': disableRowClick,
- },
- )}
- role='row'
- onClick={() => {
- if (disableRowClick) return
- const link = getFilterLink(id, entryName)
- if (link) {
- navigate(link)
- closeDetails()
- }
- }}
- >
+ const rowKey = `${id}-${entryName}-${Object.values(rest).join('-')}`
+ const rowStyle = {
+ position: 'absolute' as const,
+ top: 0,
+ transform: `translateY(${virtualRow.start}px)`,
+ width: '100%',
+ height: `${virtualRow.size}px`,
+ gridTemplateColumns,
+ }
+ const rowClassName = cx(
+ 'group grid cursor-pointer items-center text-sm text-gray-900 hover:bg-gray-100 sm:text-base dark:text-gray-50 hover:dark:bg-slate-800',
+ {
+ 'bg-gray-50 dark:bg-slate-900': isOddRow,
+ 'cursor-default': disableRowClick,
+ },
+ )
+ const openDetailsRow = () => {
+ if (disableRowClick) return
+ const link = getFilterLink(id, entryName)
+ if (link) {
+ navigate(link)
+ closeDetails()
+ }
+ }
+ const rowContent = (
+ <>
<div className='flex min-w-0 items-center py-1 pl-2 text-left'>
<span
className={cx(
@@ -2116,7 +2115,6 @@ const DetailsTable = ({
href={rowData as string}
target='_blank'
rel='noopener noreferrer nofollow'
- onClick={(e) => e.stopPropagation()}
>
{rowData}
</a>
@@ -2147,7 +2145,27 @@ const DetailsTable = ({
{!hidePercentageInDetails ? (
<div className='py-1 pr-2 text-right'>{perc}%</div>
) : null}
- </div>
+ </>
+ )
+
+ if (disableRowClick || linkContent) {
+ return (
+ <div key={rowKey} style={rowStyle} className={rowClassName}>
+ {rowContent}
+ </div>
+ )
+ }
+
+ return (
+ <button
+ key={rowKey}
+ type='button'
+ style={rowStyle}
+ className={cx(rowClassName, 'border-0 p-0 text-left')}
+ onClick={openDetailsRow}
+ >
+ {rowContent}
+ </button>
)
})}
</div>
@@ -2765,7 +2783,8 @@ const MetadataPanel = ({ metadata }: MetadataPanelProps) => {
/>
</th>
<th className='w-[30%] sm:w-1/6'>
- <p
+ <button
+ type='button'
className='flex cursor-pointer items-center justify-end hover:opacity-90'
onClick={() => onSortBy('value')}
>
@@ -2780,10 +2799,11 @@ const MetadataPanel = ({ metadata }: MetadataPanelProps) => {
}
/>
&nbsp;&nbsp;
- </p>
+ </button>
</th>
<th className='w-[30%] pr-2 sm:w-1/6'>
- <p
+ <button
+ type='button'
className='flex cursor-pointer items-center justify-end hover:opacity-90'
onClick={() => onSortBy('count')}
>
@@ -2797,7 +2817,7 @@ const MetadataPanel = ({ metadata }: MetadataPanelProps) => {
sort.label === 'count' ? sort.sortByDescend : null
}
/>
- </p>
+ </button>
</th>
</tr>
</thead>
diff --git a/web/app/pages/Project/View/components/CurrentTime.tsx b/web/app/pages/Project/View/components/CurrentTime.tsx
index a1e4b8629..e76c2b97f 100644
--- a/web/app/pages/Project/View/components/CurrentTime.tsx
+++ b/web/app/pages/Project/View/components/CurrentTime.tsx
@@ -56,6 +56,7 @@ const CurrentTime = () => {
) : (
<a
href={isAuthenticated ? '/user-settings' : '/login'}
+ aria-label='Open timezone settings'
target='_blank'
rel='noopener noreferrer'
className='border-b border-dashed border-gray-500 hover:border-solid hover:text-gray-900 dark:hover:text-white'
diff --git a/web/app/pages/Project/View/components/WaitingForAnEvent.tsx b/web/app/pages/Project/View/components/WaitingForAnEvent.tsx
index f8eec0e5c..9d4fe4fc5 100644
--- a/web/app/pages/Project/View/components/WaitingForAnEvent.tsx
+++ b/web/app/pages/Project/View/components/WaitingForAnEvent.tsx
@@ -31,6 +31,7 @@ const WaitingForAnEvent = () => {
turl: (
<a
href={TROUBLESHOOTING_URL}
+ aria-label='Open troubleshooting guide'
className='font-medium underline decoration-dashed hover:decoration-solid'
target='_blank'
rel='noreferrer noopener'
diff --git a/web/app/pages/Project/tabs/AskAI/AskAIView.tsx b/web/app/pages/Project/tabs/AskAI/AskAIView.tsx
index da63d95aa..794ec9718 100644
--- a/web/app/pages/Project/tabs/AskAI/AskAIView.tsx
+++ b/web/app/pages/Project/tabs/AskAI/AskAIView.tsx
@@ -740,11 +740,8 @@ const AssistantMessage = ({
followUps &&
followUps.length > 0 &&
onFollowUpClick ? (
- <div
- role='group'
- aria-label={t('project.askAi.followUps.title')}
- className='mt-4 border-t border-gray-200/80 dark:border-slate-800/80'
- >
+ <fieldset className='mt-4 border-t border-gray-200/80 p-0 dark:border-slate-800/80'>
+ <legend className='sr-only'>{t('project.askAi.followUps.title')}</legend>
{_map(followUps, (suggestion, idx) => (
<button
key={`${idx}-${suggestion}`}
@@ -759,7 +756,7 @@ const AssistantMessage = ({
/>
</button>
))}
- </div>
+ </fieldset>
) : null}
{!isStreaming && hasContent ? (
@@ -887,6 +884,7 @@ const UserMessage = ({
<div className='w-full max-w-[85%] rounded-2xl border border-gray-200 bg-white p-2 dark:border-slate-700 dark:bg-slate-900'>
<textarea
ref={editRef}
+ aria-label={t('project.askAi.editMessage')}
value={draft}
onChange={(e) => {
setDraft(e.target.value)
@@ -1374,6 +1372,7 @@ const TagEditor = ({
<input
ref={inputRef}
type='text'
+ aria-label={t('project.askAi.tagPlaceholder')}
value={input}
onChange={(e) => {
setInput(e.target.value)
@@ -1504,6 +1503,7 @@ const ChatRow = ({
<input
ref={nameInputRef}
type='text'
+ aria-label={t('project.askAi.renameChatPlaceholder')}
value={nameDraft}
maxLength={200}
onChange={(e) => setNameDraft(e.target.value)}
diff --git a/web/app/pages/Project/tabs/Captcha/WaitingForCaptchaEvent.tsx b/web/app/pages/Project/tabs/Captcha/WaitingForCaptchaEvent.tsx
index e002710ae..8b2d4edea 100644
--- a/web/app/pages/Project/tabs/Captcha/WaitingForCaptchaEvent.tsx
+++ b/web/app/pages/Project/tabs/Captcha/WaitingForCaptchaEvent.tsx
@@ -33,6 +33,7 @@ const WaitingForCaptchaEvent = () => {
turl: (
<a
href={TROUBLESHOOTING_URL}
+ aria-label='Open troubleshooting guide'
className='font-medium underline decoration-dashed hover:decoration-solid'
target='_blank'
rel='noreferrer noopener'
@@ -41,6 +42,7 @@ const WaitingForCaptchaEvent = () => {
guideurl: (
<a
href={CAPTCHA_INTEGRATION_GUIDE_URL}
+ aria-label='Open CAPTCHA integration guide'
className='font-medium underline decoration-dashed hover:decoration-solid'
target='_blank'
rel='noreferrer noopener'
diff --git a/web/app/pages/Project/tabs/Errors/WaitingForAnError.tsx b/web/app/pages/Project/tabs/Errors/WaitingForAnError.tsx
index 02f78998a..cc7f6d283 100644
--- a/web/app/pages/Project/tabs/Errors/WaitingForAnError.tsx
+++ b/web/app/pages/Project/tabs/Errors/WaitingForAnError.tsx
@@ -29,6 +29,7 @@ const WaitingForAnError = () => {
turl: (
<a
href={TROUBLESHOOTING_URL}
+ aria-label='Open troubleshooting guide'
className='font-medium underline decoration-dashed hover:decoration-solid'
target='_blank'
rel='noreferrer noopener'
@@ -43,6 +44,7 @@ const WaitingForAnError = () => {
howto: (
<a
href={ERROR_TRACKING_DOCS_URL}
+ aria-label='Open error tracking guide'
className='font-medium underline decoration-dashed hover:decoration-solid'
target='_blank'
rel='noreferrer noopener'
diff --git a/web/app/pages/Project/tabs/FeatureFlags/FeatureFlagSettingsModal.tsx b/web/app/pages/Project/tabs/FeatureFlags/FeatureFlagSettingsModal.tsx
index 048d2db79..93d109351 100644
--- a/web/app/pages/Project/tabs/FeatureFlags/FeatureFlagSettingsModal.tsx
+++ b/web/app/pages/Project/tabs/FeatureFlags/FeatureFlagSettingsModal.tsx
@@ -451,6 +451,7 @@ const flags = await swetrix.getFeatureFlags(undefined, true)`
</label>
<input
type='range'
+ aria-label={t('featureFlags.rolloutPercentage')}
min='0'
max='100'
value={rolloutPercentage}
@@ -767,6 +768,9 @@ const flags = await swetrix.getFeatureFlags(undefined, true)`
</label>
<input
type='range'
+ aria-label={t(
+ 'featureFlags.scheduleRolloutPercentage',
+ )}
min='0'
max='100'
value={scheduledRolloutPercentage}
diff --git a/web/app/pages/Subscribe/Subscribe.tsx b/web/app/pages/Subscribe/Subscribe.tsx
index b8e1e5244..276ea80c7 100644
--- a/web/app/pages/Subscribe/Subscribe.tsx
+++ b/web/app/pages/Subscribe/Subscribe.tsx
@@ -364,6 +364,7 @@ const Subscribe = () => {
contact: (
<a
href={`mailto:${CONTACT_EMAIL}`}
+ aria-label='Contact support'
className='font-medium underline decoration-dashed hover:decoration-solid'
/>
),
diff --git a/web/app/pages/UserSettings/UserSettings.tsx b/web/app/pages/UserSettings/UserSettings.tsx
index 294d8e934..60282066e 100644
--- a/web/app/pages/UserSettings/UserSettings.tsx
+++ b/web/app/pages/UserSettings/UserSettings.tsx
@@ -1064,7 +1064,7 @@ const UserSettings = () => {
>
{t('profileSettings.sharedTable.joinedOn')}
</th>
- <th scope='col' />
+ <th scope='col' aria-label='Actions' />
</tr>
</thead>
<tbody className='divide-y divide-gray-200 bg-white dark:divide-slate-800 dark:bg-slate-950'>
@@ -1117,7 +1117,7 @@ const UserSettings = () => {
>
{t('profileSettings.sharedTable.joinedOn')}
</th>
- <th scope='col' />
+ <th scope='col' aria-label='Actions' />
</tr>
</thead>
<tbody className='divide-y divide-gray-200 bg-white dark:divide-slate-800 dark:bg-slate-950'>
@@ -1163,7 +1163,7 @@ const UserSettings = () => {
'profileSettings.organisationsTable.joinedOn',
)}
</th>
- <th scope='col' />
+ <th scope='col' aria-label='Actions' />
</tr>
</thead>
<tbody className='divide-y divide-gray-200 bg-white dark:divide-slate-800 dark:bg-slate-950'>
diff --git a/web/app/pages/UserSettings/components/Socialisations.tsx b/web/app/pages/UserSettings/components/Socialisations.tsx
index 06a373225..c726831a9 100644
--- a/web/app/pages/UserSettings/components/Socialisations.tsx
+++ b/web/app/pages/UserSettings/components/Socialisations.tsx
@@ -194,7 +194,7 @@ const Socialisations = () => {
>
{t('common.status')}
</th>
- <th scope='col' className='px-4 py-3' />
+ <th scope='col' aria-label='Actions' className='px-4 py-3' />
</tr>
</thead>
<tbody className='divide-y divide-gray-200 bg-white dark:divide-slate-800 dark:bg-slate-950'>
@@ -206,15 +206,19 @@ const Socialisations = () => {
return (
<tr
key={key}
+ aria-label={name}
className='hover:bg-gray-50 dark:hover:bg-slate-900/50'
>
- <td className='px-4 py-3 text-sm text-gray-900 dark:text-gray-100'>
+ <td
+ aria-label={name}
+ className='px-4 py-3 text-sm text-gray-900 dark:text-gray-100'
+ >
<div className='flex items-center gap-3'>
<div className='hidden shrink-0 sm:block'>
{theme === 'dark' ? (
- <Light className='h-9 w-9 rounded-md' />
+ <Light className='h-9 w-9 rounded-md' aria-hidden='true' />
) : (
- <Dark className='h-9 w-9 rounded-md' />
+ <Dark className='h-9 w-9 rounded-md' aria-hidden='true' />
)}
</div>
<span className='font-medium'>{name}</span>
diff --git a/web/app/root.tsx b/web/app/root.tsx
index 6451720f6..57836731d 100644
--- a/web/app/root.tsx
+++ b/web/app/root.tsx
@@ -273,14 +273,13 @@ export function ErrorBoundary() {
)}
</button>
{crashStackShown ? (
- <span
+ <section
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}
- </span>
+ </section>
) : null}
</>
) : (
diff --git a/web/app/routes/google-analytics-alternative.tsx b/web/app/routes/google-analytics-alternative.tsx
index 3580a8d09..ecd0f9616 100644
--- a/web/app/routes/google-analytics-alternative.tsx
+++ b/web/app/routes/google-analytics-alternative.tsx
@@ -101,11 +101,8 @@ const Testimonials = ({ className }: { className?: string }) => {
))}
</div>
<div className='mt-1 flex flex-col items-center justify-center gap-1 md:items-start'>
- <div
- className='relative inline-flex'
- role='img'
- aria-label='5 out of 5 stars'
- >
+ <div className='relative inline-flex'>
+ <span className='sr-only'>5 out of 5 stars</span>
<StarIcon
className='size-5 text-yellow-500'
aria-hidden='true'
diff --git a/web/app/ui/CaptchaSetup.tsx b/web/app/ui/CaptchaSetup.tsx
index a06c1f038..135ca417d 100644
--- a/web/app/ui/CaptchaSetup.tsx
+++ b/web/app/ui/CaptchaSetup.tsx
@@ -130,6 +130,7 @@ const CaptchaSetup = ({ projectId }: CaptchaSetupProps) => {
url: (
<a
href={CAPTCHA_DOCS_URL}
+ aria-label='Open CAPTCHA documentation'
target='_blank'
rel='noopener noreferrer'
className='font-medium underline decoration-dashed hover:decoration-solid'
@@ -174,6 +175,7 @@ const CaptchaSetup = ({ projectId }: CaptchaSetupProps) => {
url: (
<a
href={CAPTCHA_VALIDATION_DOCS_URL}
+ aria-label='Open CAPTCHA validation documentation'
target='_blank'
rel='noopener noreferrer'
className='font-medium underline decoration-dashed hover:decoration-solid'
diff --git a/web/app/ui/FileUpload.tsx b/web/app/ui/FileUpload.tsx
index 2ac296c39..6eaa532d9 100644
--- a/web/app/ui/FileUpload.tsx
+++ b/web/app/ui/FileUpload.tsx
@@ -134,6 +134,7 @@ export default function FileUpload({
accept={accept}
multiple={multiple}
disabled={isDisabled}
+ aria-label={typeof label === 'string' ? label : 'Upload file'}
aria-describedby={showHint ? hintId : undefined}
onChange={handleChange}
/>
diff --git a/web/app/ui/FilterValueInput.tsx b/web/app/ui/FilterValueInput.tsx
index 567f11398..9ecd3e1ee 100644
--- a/web/app/ui/FilterValueInput.tsx
+++ b/web/app/ui/FilterValueInput.tsx
@@ -395,6 +395,7 @@ const FilterValueInput = ({
},
)}
placeholder={placeholder}
+ aria-label={placeholder}
value={isOpen ? inputValue : displayValue}
onChange={handleInputChange}
onFocus={handleFocus}
diff --git a/web/app/ui/Loader.tsx b/web/app/ui/Loader.tsx
index 3393181fb..2b266837f 100644
--- a/web/app/ui/Loader.tsx
+++ b/web/app/ui/Loader.tsx
@@ -7,14 +7,13 @@ interface LoaderProps {
}
const Loader = ({ className, label = 'Loading' }: LoaderProps) => (
- <div
+ <output
className={cn('flex items-center justify-center pt-10', className)}
- role='status'
aria-live='polite'
>
<Spin className='mr-0! ml-0!' />
<span className='sr-only'>{label}</span>
- </div>
+ </output>
)
export default Loader
diff --git a/web/app/ui/LoadingBar.tsx b/web/app/ui/LoadingBar.tsx
index eb0fa6ddd..429e1e8d5 100644
--- a/web/app/ui/LoadingBar.tsx
+++ b/web/app/ui/LoadingBar.tsx
@@ -12,9 +12,8 @@ const LoadingBar: React.FC<LoadingBarProps> = ({ className }) => {
'fixed top-0 right-0 left-0 z-50 h-0.5 w-full overflow-hidden bg-transparent',
className,
)}
- role='progressbar'
- aria-label='Loading'
>
+ <progress className='sr-only' aria-label='Loading' />
<div
className='absolute h-full rounded-full bg-linear-to-r from-slate-400 via-slate-700 to-slate-900 dark:from-slate-500 dark:via-slate-200 dark:to-white'
style={{
diff --git a/web/app/ui/MultiSelect.tsx b/web/app/ui/MultiSelect.tsx
index c43c2588f..3eb7043ba 100644
--- a/web/app/ui/MultiSelect.tsx
+++ b/web/app/ui/MultiSelect.tsx
@@ -170,7 +170,7 @@ const MultiSelect = ({
<input
ref={inputRef}
type='text'
- aria-expanded={isOpen}
+ aria-label={placeholder}
aria-controls={listboxId}
aria-autocomplete='list'
aria-activedescendant={activeOptionId}
@@ -197,8 +197,6 @@ const MultiSelect = ({
>
<div
id={listboxId}
- role='listbox'
- aria-multiselectable='true'
className='absolute top-full z-30 mt-1.5 max-h-60 w-full overflow-auto rounded-lg bg-white py-1 text-sm shadow-lg ring-1 ring-gray-200/80 focus:outline-hidden dark:bg-slate-950 dark:ring-slate-700/60'
>
{_isEmpty(items) ? (
@@ -216,12 +214,11 @@ const MultiSelect = ({
const isActive = index === activeIndex
const optionId = `${optionIdPrefix}-${index}`
return (
- <button
- type='button'
- id={optionId}
- role='option'
- aria-selected={isSelected}
- key={`${itemKey(item)}-select`}
+ <button
+ type='button'
+ id={optionId}
+ aria-pressed={isSelected}
+ key={`${itemKey(item)}-select`}
onClick={() => handleSelectItem(item)}
onMouseEnter={() => setActiveIndex(index)}
className={cx(
diff --git a/web/app/ui/PasswordStrength.tsx b/web/app/ui/PasswordStrength.tsx
index b21deaf79..8250ab3c2 100644
--- a/web/app/ui/PasswordStrength.tsx
+++ b/web/app/ui/PasswordStrength.tsx
@@ -82,17 +82,17 @@ const PasswordStrength = ({ password, className }: PasswordStrengthProps) => {
const trackBg = 'bg-gray-200 dark:bg-slate-800'
return (
- <div
- className={cx('space-y-1.5', className)}
- role='progressbar'
- aria-valuemin={0}
- aria-valuemax={totalSegments}
- aria-valuenow={currentConfig.segments}
- aria-valuetext={currentConfig.label || undefined}
- aria-label={t('auth.passwordStrength.label', {
- defaultValue: 'Password strength',
- })}
- >
+ <div className={cx('space-y-1.5', className)}>
+ <progress
+ className='sr-only'
+ max={totalSegments}
+ value={currentConfig.segments}
+ aria-label={t('auth.passwordStrength.label', {
+ defaultValue: 'Password strength',
+ })}
+ >
+ {currentConfig.label}
+ </progress>
<div className='flex gap-1.5'>
{Array.from({ length: totalSegments }).map((_, index) => (
<div
diff --git a/web/app/ui/ProgressRing.tsx b/web/app/ui/ProgressRing.tsx
index b87344019..2d39168d4 100644
--- a/web/app/ui/ProgressRing.tsx
+++ b/web/app/ui/ProgressRing.tsx
@@ -91,12 +91,13 @@ const ProgressRing = ({
'relative inline-flex items-center justify-center',
className,
)}
- role='progressbar'
- aria-valuemin={0}
- aria-valuemax={100}
- aria-valuenow={displayValue}
- aria-label={ariaLabel ?? `Progress: ${displayValue}%`}
>
+ <progress
+ className='sr-only'
+ max={100}
+ value={displayValue}
+ aria-label={ariaLabel ?? `Progress: ${displayValue}%`}
+ />
<svg width={size} height={size} className='-rotate-90' aria-hidden='true'>
<circle
cx={center}
diff --git a/web/app/ui/StatusPage.tsx b/web/app/ui/StatusPage.tsx
index b67b8b985..66ceceb45 100644
--- a/web/app/ui/StatusPage.tsx
+++ b/web/app/ui/StatusPage.tsx
@@ -79,14 +79,13 @@ const StatusPage = ({
if (loading) {
return (
<div className='flex min-h-page items-center justify-center bg-gray-50 dark:bg-slate-950'>
- <div
+ <output
className='flex flex-col items-center'
- role='status'
aria-live='polite'
>
<Spin />
<span className='sr-only'>{t('common.loading')}</span>
- </div>
+ </output>
</div>
)
}
diff --git a/web/app/ui/TimezonePicker.tsx b/web/app/ui/TimezonePicker.tsx
index 8138ea8c2..12cc514ef 100644
--- a/web/app/ui/TimezonePicker.tsx
+++ b/web/app/ui/TimezonePicker.tsx
@@ -439,7 +439,7 @@ const TimezoneSelect = ({ value, onChange }: TimezoneSelectProps) => {
setSearchValue(event.target.value)
}}
onKeyDown={handleInputKeyDown}
- aria-expanded={isOpen}
+ aria-label={t('profileSettings.timezone')}
aria-controls={listboxId}
aria-activedescendant={
isOpen && filteredOptions[activeIndex]
@@ -468,12 +468,11 @@ const TimezoneSelect = ({ value, onChange }: TimezoneSelectProps) => {
leaveTo='opacity-0 -translate-y-0.5'
>
<div className='absolute z-50 mt-1 w-full min-w-[200px] overflow-hidden rounded-md bg-white text-sm ring-1 ring-gray-200 focus:outline-hidden dark:bg-slate-950 dark:ring-slate-800'>
- <div
- id={listboxId}
- role='listbox'
- aria-label={t('profileSettings.timezone')}
- className='max-h-80 overflow-auto py-1'
- >
+ <div
+ id={listboxId}
+ aria-label={t('profileSettings.timezone')}
+ className='max-h-80 overflow-auto py-1'
+ >
{filteredOptions.length ? (
filteredOptions.map((option, index) => {
const selected = option.value === selectedTimezone?.value
@@ -481,12 +480,11 @@ const TimezoneSelect = ({ value, onChange }: TimezoneSelectProps) => {
return (
<button
- id={`${listboxId}-option-${index}`}
- key={option.value}
- type='button'
- role='option'
- aria-selected={selected}
- onMouseEnter={() => setActiveIndex(index)}
+ id={`${listboxId}-option-${index}`}
+ key={option.value}
+ type='button'
+ aria-pressed={selected}
+ onMouseEnter={() => setActiveIndex(index)}
onClick={() => handleSelect(option)}
className={cx(
'mx-1 flex w-[calc(100%-0.5rem)] cursor-pointer items-center gap-2 rounded-md px-3 py-2 text-left transition-colors duration-100 ease-out select-none',
diff --git a/web/app/ui/TrackingSetup.tsx b/web/app/ui/TrackingSetup.tsx
index 983bcdc73..304e9be03 100644
--- a/web/app/ui/TrackingSetup.tsx
+++ b/web/app/ui/TrackingSetup.tsx
@@ -560,6 +560,7 @@ const TrackingSetup = ({ projectId }: TrackingSetupProps) => {
url: (
<a
href={`${DOCS_URL}/install-script`}
+ aria-label='Open tracking setup documentation'
target='_blank'
rel='noopener noreferrer'
className='font-medium underline decoration-dashed hover:decoration-solid'