mirror of
https://github.com/supabase/supabase.git
synced 2026-10-05 09:25:06 +03:00
fix: ESLint errors relating to accessibility (alt attribute and tableEditor components) (#48186)
## I have read the [CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md) file. YES ## What kind of change does this PR introduce? Improvements for screen readers: - Added `alt` attributes to image components - Added `aria-label` attributes and Tooltip to buttons ## What is the current behavior? `aria-label`, `alt` attributes and Tooltip were missing ## What is the new behavior? Buttons have now `aria-label` attributes and Tooltip. Images have `alt` attributes ## Additional context I’ve added `aria-label` attributes to the buttons in the Pagination.tsx component, but these buttons don’t trigger any action. Shouldn’t we be using non-interactive elements here? No visual changes have been made. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Accessibility** * Added a tooltip to the “date options” control when the value is nullable. * Improved screen-reader labeling by adding an `aria-label` to the number editor input. * Added explicit `aria-label` text to pagination footer buttons for loading, error, and help/estimate states (and marked the error-state button as disabled). * **UI** * Updated the pagination loading-state button to rely on the button’s built-in loading behavior instead of a custom spinner icon. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Gildas Garcia <1122076+djhi@users.noreply.github.com>
This commit is contained in:
1 parent
f01ac83ebc
commit
da847254d5
5 files changed
+26
-13
No files matched your search
@@ -135,6 +135,8 @@ const Image = forwardRef(function Image(
|
||||
: style
|
||||
|
||||
return (
|
||||
// alt is spread with rest
|
||||
// eslint-disable-next-line jsx-a11y/alt-text
|
||||
<img
|
||||
{...rest}
|
||||
ref={(node) => {
|
||||
|
||||
@@ -140,6 +140,8 @@ const Image = forwardRef(function Image(
|
||||
: undefined
|
||||
|
||||
return (
|
||||
// alt is spread with rest
|
||||
// eslint-disable-next-line jsx-a11y/alt-text
|
||||
<img
|
||||
{...rest}
|
||||
ref={(node) => {
|
||||
|
||||
@@ -12,6 +12,9 @@ import {
|
||||
Popover,
|
||||
PopoverContent,
|
||||
PopoverTrigger,
|
||||
Tooltip,
|
||||
TooltipContent,
|
||||
TooltipTrigger,
|
||||
} from 'ui'
|
||||
import { Input } from 'ui-patterns/DataInputs/Input'
|
||||
import { TimestampInfo, timestampLocalFormatter } from 'ui-patterns/TimestampInfo'
|
||||
@@ -149,13 +152,19 @@ function BaseEditor<TRow, TSummaryRow = unknown>({
|
||||
Set NULL
|
||||
</Button>
|
||||
<DropdownMenu>
|
||||
<DropdownMenuTrigger asChild>
|
||||
<Button
|
||||
variant="default"
|
||||
icon={<ChevronDown />}
|
||||
className="px-1 rounded-l-none border-l-0"
|
||||
/>
|
||||
</DropdownMenuTrigger>
|
||||
<Tooltip>
|
||||
<TooltipTrigger asChild>
|
||||
<DropdownMenuTrigger asChild>
|
||||
<Button
|
||||
aria-label="Date options"
|
||||
variant="default"
|
||||
icon={<ChevronDown />}
|
||||
className="px-1 rounded-l-none border-l-0"
|
||||
/>
|
||||
</DropdownMenuTrigger>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent side="bottom">Date options</TooltipContent>
|
||||
</Tooltip>
|
||||
<DropdownMenuContent className="w-20" align="end">
|
||||
<DropdownMenuItem onClick={setToNow}>Set to NOW</DropdownMenuItem>
|
||||
</DropdownMenuContent>
|
||||
|
||||
@@ -31,6 +31,7 @@ export function NumberEditor<TRow, TSummaryRow = unknown>({
|
||||
onChange={onChange}
|
||||
onBlur={onBlur}
|
||||
type="number"
|
||||
aria-label={`${column.name} value`}
|
||||
/>
|
||||
)
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
import { THRESHOLD_COUNT } from '@supabase/pg-meta'
|
||||
import { keepPreviousData } from '@tanstack/react-query'
|
||||
import { useParams } from 'common'
|
||||
import { AlertCircle, ArrowLeft, ArrowRight, HelpCircle, Loader2 } from 'lucide-react'
|
||||
import { AlertCircle, ArrowLeft, ArrowRight, HelpCircle } from 'lucide-react'
|
||||
import { useEffect, useRef, useState } from 'react'
|
||||
import { Button, Tooltip, TooltipContent, TooltipTrigger } from 'ui'
|
||||
import { Input } from 'ui-patterns/DataInputs/Input'
|
||||
@@ -295,11 +295,7 @@ export const Pagination = ({ enableForeignRowsQuery = true }: PaginationProps) =
|
||||
</div>
|
||||
|
||||
{isLoading ? (
|
||||
<Button
|
||||
variant="text"
|
||||
className="w-7"
|
||||
icon={<Loader2 size={12} className="animate-spin" />}
|
||||
/>
|
||||
<Button variant="text" className="w-7" loading aria-label="Get exact row count" />
|
||||
) : isError ? (
|
||||
<Tooltip>
|
||||
<TooltipTrigger asChild>
|
||||
@@ -309,6 +305,8 @@ export const Pagination = ({ enableForeignRowsQuery = true }: PaginationProps) =
|
||||
className="w-7"
|
||||
loading={isFetching}
|
||||
icon={<AlertCircle />}
|
||||
aria-label="Get exact row count"
|
||||
disabled
|
||||
/>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent side="top">Failed to retrieve count: {error?.message}</TooltipContent>
|
||||
@@ -331,6 +329,7 @@ export const Pagination = ({ enableForeignRowsQuery = true }: PaginationProps) =
|
||||
className="w-7"
|
||||
loading={isFetching}
|
||||
icon={<HelpCircle />}
|
||||
aria-label="Get exact row count"
|
||||
onClick={() => {
|
||||
// Show warning if either NOT a table entity, or table rows estimate is beyond threshold
|
||||
if (rowsCountEstimate === null || count === -1 || count > THRESHOLD_COUNT) {
|
||||
|
||||
Reference in new issue
Block a user