Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

fix: new project form accessibility issues (#47785)

Gildas Garcia72aa214b0c90
diff --git a/apps/studio/components/interfaces/ProjectCreation/ComputeSizeSelector.tsx b/apps/studio/components/interfaces/ProjectCreation/ComputeSizeSelector.tsx
index 70fd51bb8b0..730ed0ef42d 100644
--- a/apps/studio/components/interfaces/ProjectCreation/ComputeSizeSelector.tsx
+++ b/apps/studio/components/interfaces/ProjectCreation/ComputeSizeSelector.tsx
@@ -32,6 +32,7 @@ export const ComputeSizeSelector = ({ form }: ComputeSizeSelectorProps) => {
name="instanceSize"
render={({ field }) => (
<FormItemLayout
+ id="instanceSize"
layout="horizontal"
label="Compute size"
description={
@@ -51,7 +52,10 @@ export const ComputeSizeSelector = ({ form }: ComputeSizeSelectorProps) => {
}
>
<Select value={field.value} onValueChange={(value) => field.onChange(value)}>
- <SelectTrigger className="[&>span>div>div>[data-field=instance-details]]:hidden">
+ <SelectTrigger
+ id="instanceSize"
+ className="[&>span>div>div>[data-field=instance-details]]:hidden"
+ >
<SelectValue placeholder="Select a compute size" />
</SelectTrigger>
<SelectContent>
diff --git a/apps/studio/components/interfaces/ProjectCreation/DatabasePasswordInput.tsx b/apps/studio/components/interfaces/ProjectCreation/DatabasePasswordInput.tsx
index 46deeeb3ee9..95bca3d0fd7 100644
--- a/apps/studio/components/interfaces/ProjectCreation/DatabasePasswordInput.tsx
+++ b/apps/studio/components/interfaces/ProjectCreation/DatabasePasswordInput.tsx
@@ -49,6 +49,7 @@ export const DatabasePasswordInput = ({ form }: DatabasePasswordInputProps) => {
render={({ field }) => {
return (
<FormItemLayout
+ id="dbPass"
label="Database password"
layout="horizontal"
description={
@@ -66,6 +67,7 @@ export const DatabasePasswordInput = ({ form }: DatabasePasswordInputProps) => {
type="password"
placeholder="Type in a strong password"
{...field}
+ id="dbPass"
autoComplete="off"
onChange={async (event) => {
const newValue = event.target.value
diff --git a/apps/studio/components/interfaces/ProjectCreation/OrganizationSelector.tsx b/apps/studio/components/interfaces/ProjectCreation/OrganizationSelector.tsx
index 4175d6df8a2..070ab1292e2 100644
--- a/apps/studio/components/interfaces/ProjectCreation/OrganizationSelector.tsx
+++ b/apps/studio/components/interfaces/ProjectCreation/OrganizationSelector.tsx
@@ -54,34 +54,35 @@ export const OrganizationSelector = ({ form }: OrganizationSelectorProps) => {
control={form.control}
name="organization"
render={({ field }) => (
- <FormItemLayout label="Organization" layout="horizontal">
+ <FormItemLayout id="organization" label="Organization" layout="horizontal">
{(organizations?.length ?? 0) > 0 && (
- <Select
- onValueChange={(slug) => {
- field.onChange(slug)
- router.push(`/new/${slug}`)
- }}
- value={field.value}
- defaultValue={field.value}
- >
- <FormControl>
- <SelectTrigger>
+ <FormControl>
+ <Select
+ name="organization"
+ onValueChange={(slug) => {
+ field.onChange(slug)
+ router.push(`/new/${slug}`)
+ }}
+ value={field.value}
+ defaultValue={field.value}
+ >
+ <SelectTrigger id="organization">
<SelectValue placeholder="Select an organization" />
</SelectTrigger>
- </FormControl>
- <SelectContent>
- <SelectGroup>
- {organizations?.map((x) => (
- <SelectItem key={x.id} value={x.slug}>
- <div className="flex justify-between items-center gap-2 w-full">
- <span>{x.name}</span>
- <Badge className="mt-px">{x.plan.name}</Badge>
- </div>
- </SelectItem>
- ))}
- </SelectGroup>
- </SelectContent>
- </Select>
+ <SelectContent>
+ <SelectGroup>
+ {organizations?.map((x) => (
+ <SelectItem key={x.id} value={x.slug}>
+ <div className="flex justify-between items-center gap-2 w-full">
+ <span>{x.name}</span>
+ <Badge className="mt-px">{x.plan.name}</Badge>
+ </div>
+ </SelectItem>
+ ))}
+ </SelectGroup>
+ </SelectContent>
+ </Select>
+ </FormControl>
)}
</FormItemLayout>
)}
diff --git a/apps/studio/components/interfaces/ProjectCreation/PostgresVersionSelector.tsx b/apps/studio/components/interfaces/ProjectCreation/PostgresVersionSelector.tsx
index 0812c472a68..b8b459649bd 100644
--- a/apps/studio/components/interfaces/ProjectCreation/PostgresVersionSelector.tsx
+++ b/apps/studio/components/interfaces/ProjectCreation/PostgresVersionSelector.tsx
@@ -102,7 +102,7 @@ export const PostgresVersionSelector = ({
}, [isSuccess, availableVersions, form])
return (
- <FormItemLayout label={label} layout={layout}>
+ <FormItemLayout id={field.name} label={label} layout={layout}>
<Select
value={postgresVersionSelection}
onValueChange={field.onChange}
@@ -112,7 +112,10 @@ export const PostgresVersionSelector = ({
(type === 'unpause' && isLoadingProjectUnpauseVersions)
}
>
- <SelectTrigger className="[&>:nth-child(1)]:w-full [&>:nth-child(1)]:flex [&>:nth-child(1)]:items-start">
+ <SelectTrigger
+ id={field.name}
+ className="[&>:nth-child(1)]:w-full [&>:nth-child(1)]:flex [&>:nth-child(1)]:items-start"
+ >
<SelectValue placeholder="Select a Postgres version for your project" />
</SelectTrigger>
<SelectContent>
diff --git a/apps/studio/components/interfaces/ProjectCreation/ProjectNameInput.tsx b/apps/studio/components/interfaces/ProjectCreation/ProjectNameInput.tsx
index a8f53ec33af..c415cd64d6f 100644
--- a/apps/studio/components/interfaces/ProjectCreation/ProjectNameInput.tsx
+++ b/apps/studio/components/interfaces/ProjectCreation/ProjectNameInput.tsx
@@ -16,9 +16,9 @@ export const ProjectNameInput = ({ form }: ProjectNameInputProps) => {
control={form.control}
name="projectName"
render={({ field }) => (
- <FormItemLayout label="Project name" layout="horizontal">
+ <FormItemLayout id="projectName" label="Project name" layout="horizontal">
<FormControl>
- <Input {...field} placeholder="Project name" />
+ <Input {...field} id="projectName" placeholder="Project name" />
</FormControl>
</FormItemLayout>
)}
diff --git a/apps/studio/components/interfaces/ProjectCreation/RegionSelector.tsx b/apps/studio/components/interfaces/ProjectCreation/RegionSelector.tsx
index 9593bf99ec8..25cd97d922e 100644
--- a/apps/studio/components/interfaces/ProjectCreation/RegionSelector.tsx
+++ b/apps/studio/components/interfaces/ProjectCreation/RegionSelector.tsx
@@ -4,6 +4,7 @@ import type { CloudProvider } from 'shared-data'
import {
Badge,
cn,
+ FormControl,
FormField,
Select,
SelectContent,
@@ -149,6 +150,7 @@ export const RegionSelector = ({
return (
<>
<FormItemLayout
+ id="region"
layout={layout}
label="Region"
description={
@@ -167,125 +169,133 @@ export const RegionSelector = ({
</>
}
>
- <Select value={field.value} onValueChange={field.onChange} disabled={isLoading}>
- <SelectTrigger className="[&>:nth-child(1)]:w-full [&>:nth-child(1)]:flex [&>:nth-child(1)]:items-start">
- <SelectValue
- placeholder={
- isLoading
- ? 'Loading available regions...'
- : 'Select a region for your project..'
- }
+ <FormControl>
+ <Select value={field.value} onValueChange={field.onChange} disabled={isLoading}>
+ <SelectTrigger
+ id="region"
+ className="[&>:nth-child(1)]:w-full [&>:nth-child(1)]:flex [&>:nth-child(1)]:items-start"
>
- {field.value !== undefined && (
- <div className="flex items-center gap-x-3">
- {selectedRegion?.code && (
- <img
- alt="region icon"
- className="w-5 rounded-xs"
- src={`${BASE_PATH}/img/regions/${selectedRegion.code}.svg`}
- />
- )}
- <span className="text-foreground">
- {selectedRegion?.name
- ? getDisplayNameForSmartRegion(selectedRegion.name)
- : field.value}
- </span>
- </div>
- )}
- </SelectValue>
- </SelectTrigger>
- <SelectContent>
- {smartRegionEnabled && (
- <>
- <SelectGroup>
- <SelectLabel>General regions</SelectLabel>
- {smartRegions.map((value) => {
- return (
- <SelectItem
- key={value.code}
- value={value.name}
- className="w-full [&>:nth-child(2)]:w-full"
- >
- <div className="flex flex-row items-center justify-between w-full">
- <div className="flex items-center gap-x-3">
- <img
- alt="region icon"
- className="w-5 rounded-xs"
- src={`${BASE_PATH}/img/regions/${value.code}.svg`}
- />
- <span className="text-foreground">
- {getDisplayNameForSmartRegion(value.name)}
- </span>
+ <SelectValue
+ placeholder={
+ isLoading
+ ? 'Loading available regions...'
+ : 'Select a region for your project..'
+ }
+ >
+ {field.value !== undefined && (
+ <div className="flex items-center gap-x-3">
+ {selectedRegion?.code && (
+ // For some reason, Safari considered the empty string alt text on this icon as misspelled (with VoiceOver)
+ // Only way to fix it is to set the role. Not needed for the combobox options
+ // eslint-disable-next-line jsx-a11y/alt-text
+ <img
+ role="presentation"
+ className="w-5 rounded-xs"
+ src={`${BASE_PATH}/img/regions/${selectedRegion.code}.svg`}
+ />
+ )}
+ <span className="text-foreground">
+ {selectedRegion?.name
+ ? getDisplayNameForSmartRegion(selectedRegion.name)
+ : field.value}
+ </span>
+ </div>
+ )}
+ </SelectValue>
+ </SelectTrigger>
+ <SelectContent>
+ {smartRegionEnabled && (
+ <>
+ <SelectGroup>
+ <SelectLabel>General regions</SelectLabel>
+ {smartRegions.map((value) => {
+ return (
+ <SelectItem
+ key={value.code}
+ value={value.name}
+ className="w-full [&>:nth-child(2)]:w-full"
+ >
+ <div className="flex flex-row items-center justify-between w-full">
+ <div className="flex items-center gap-x-3">
+ <img
+ alt=""
+ className="w-5 rounded-xs"
+ src={`${BASE_PATH}/img/regions/${value.code}.svg`}
+ />
+ <span className="text-foreground">
+ {getDisplayNameForSmartRegion(value.name)}
+ </span>
+ </div>
+
+ <div>
+ {recommendedSmartRegions.has(value.code) && (
+ <Badge variant="success" className="mr-1">
+ Recommended
+ </Badge>
+ )}
+ </div>
</div>
+ </SelectItem>
+ )
+ })}
+ </SelectGroup>
+ <SelectSeparator />
+ </>
+ )}
- <div>
- {recommendedSmartRegions.has(value.code) && (
- <Badge variant="success" className="mr-1">
- Recommended
- </Badge>
- )}
+ <SelectGroup>
+ <SelectLabel>Specific regions</SelectLabel>
+ {regionOptions.map((value) => {
+ return (
+ <SelectItem
+ key={value.code}
+ value={value.name}
+ className={cn(
+ 'w-full [&>:nth-child(2)]:w-full',
+ value.status !== undefined && 'pointer-events-auto!'
+ )}
+ disabled={value.status !== undefined}
+ >
+ <div className="flex flex-row items-center justify-between w-full gap-x-2">
+ <div className="flex items-center gap-x-3">
+ <img
+ alt=""
+ className="w-5 rounded-xs"
+ src={`${BASE_PATH}/img/regions/${value.code}.svg`}
+ />
+ <div className="flex items-center gap-x-2">
+ <span className="text-foreground">{value.name}</span>
+ <span className="text-xs text-foreground-lighter font-mono">
+ {value.code}
+ </span>
</div>
</div>
- </SelectItem>
- )
- })}
- </SelectGroup>
- <SelectSeparator />
- </>
- )}
- <SelectGroup>
- <SelectLabel>Specific regions</SelectLabel>
- {regionOptions.map((value) => {
- return (
- <SelectItem
- key={value.code}
- value={value.name}
- className={cn(
- 'w-full [&>:nth-child(2)]:w-full',
- value.status !== undefined && 'pointer-events-auto!'
- )}
- disabled={value.status !== undefined}
- >
- <div className="flex flex-row items-center justify-between w-full gap-x-2">
- <div className="flex items-center gap-x-3">
- <img
- alt="region icon"
- className="w-5 rounded-xs"
- src={`${BASE_PATH}/img/regions/${value.code}.svg`}
- />
- <div className="flex items-center gap-x-2">
- <span className="text-foreground">{value.name}</span>
- <span className="text-xs text-foreground-lighter font-mono">
- {value.code}
- </span>
- </div>
+ {recommendedSpecificRegions.has(value.code) && (
+ <Badge variant="success" className="mr-1">
+ Recommended
+ </Badge>
+ )}
+ {value.status !== undefined && value.status === 'capacity' && (
+ <Tooltip>
+ <TooltipTrigger>
+ <Badge variant="warning" className="mr-1">
+ Unavailable
+ </Badge>
+ </TooltipTrigger>
+ <TooltipContent>
+ Temporarily unavailable due to this region being at capacity.
+ </TooltipContent>
+ </Tooltip>
+ )}
</div>
-
- {recommendedSpecificRegions.has(value.code) && (
- <Badge variant="success" className="mr-1">
- Recommended
- </Badge>
- )}
- {value.status !== undefined && value.status === 'capacity' && (
- <Tooltip>
- <TooltipTrigger>
- <Badge variant="warning" className="mr-1">
- Unavailable
- </Badge>
- </TooltipTrigger>
- <TooltipContent>
- Temporarily unavailable due to this region being at capacity.
- </TooltipContent>
- </Tooltip>
- )}
- </div>
- </SelectItem>
- )
- })}
- </SelectGroup>
- </SelectContent>
- </Select>
+ </SelectItem>
+ )
+ })}
+ </SelectGroup>
+ </SelectContent>
+ </Select>
+ </FormControl>
</FormItemLayout>
{affectingIncidents.length > 0 && (
diff --git a/apps/studio/components/interfaces/Settings/Integrations/GithubIntegration/GitHubRepositoryField.tsx b/apps/studio/components/interfaces/Settings/Integrations/GithubIntegration/GitHubRepositoryField.tsx
index 4bc48dd12e9..5d5d0b5fb84 100644
--- a/apps/studio/components/interfaces/Settings/Integrations/GithubIntegration/GitHubRepositoryField.tsx
+++ b/apps/studio/components/interfaces/Settings/Integrations/GithubIntegration/GitHubRepositoryField.tsx
@@ -133,10 +133,11 @@ export const GitHubRepositoryField = <TFormValues extends FieldValues>({
control={form.control}
name={name}
render={({ field }) => (
- <FormItemLayout label={label} layout={layout} description={description}>
+ <FormItemLayout id={name} label={label} layout={layout} description={description}>
{gitHubAuthorization === null ? (
<FormControl>
<Button
+ id={name}
variant="default"
size="small"
type="button"
@@ -155,6 +156,7 @@ export const GitHubRepositoryField = <TFormValues extends FieldValues>({
<PopoverTrigger asChild>
<FormControl>
<Button
+ id={name}
variant="default"
type="button"
className="justify-start h-[34px] w-full"