Files
ChloeGarciaMillerandandGildas Garcia ef7b2a5211 fix: ESLint errors relating to accessibility in integration section (#50224)
## 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?

Improving accessibility by adding aria-label.
Adding Tooltip for icon only buttons.

## What is the current behavior?

Some `aria-label` and `Tooltip` are missing.

## What is the new behavior?

Icon-only buttons have now Tooltip and aria-label have been added.

## Additional context

No visual changes have been made.

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **Accessibility Improvements**
* Added descriptive tooltips and screen-reader labels to search-clear
and close-panel controls.
* Added accessible labels and tooltips for managing secrets, showing or
hiding secret values, and editing or removing foreign tables.
* Improved the lint details panel close control with a descriptive
label.
* Prevented duplicate tooltip announcements for assistive technologies.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Gildas Garcia <1122076+djhi@users.noreply.github.com>
2026-09-22 11:31:30 +02:00

82 lines
2.4 KiB
TypeScript

import { RefreshCw, Search, X } from 'lucide-react'
import type { KeyboardEvent, Ref } from 'react'
import { Button, Tooltip, TooltipContent, TooltipTrigger } from 'ui'
import { Input } from 'ui-patterns/DataInputs/Input'
import { EnableCleanupButton } from './CronJobsTab.EnableCleanupButton'
import { onSearchInputEscape } from '@/lib/keyboard'
interface CronJobsTabHeaderProps {
search: string
isRefreshing: boolean
searchInputRef?: Ref<HTMLInputElement>
onSearchChange: (value: string) => void
onSearchSubmit: () => void
onClearSearch: () => void
onRefresh: () => void
onCreateJob: () => void
}
export const CronJobsTabHeader = ({
search,
isRefreshing,
searchInputRef,
onSearchChange,
onSearchSubmit,
onClearSearch,
onRefresh,
onCreateJob,
}: CronJobsTabHeaderProps) => {
const handleKeyDown = (event: KeyboardEvent<HTMLInputElement>) => {
onSearchInputEscape(search, onClearSearch)(event)
if (event.key === 'Enter' || event.code === 'NumpadEnter') {
onSearchSubmit()
}
}
return (
<div className="bg-surface-200 py-3 px-10 flex items-center justify-between flex-wrap gap-y-2">
<Input
ref={searchInputRef}
size="tiny"
className="w-52"
placeholder="Search for a job"
icon={<Search />}
value={search}
onChange={(e) => onSearchChange(e.target.value)}
onKeyDown={handleKeyDown}
actions={[
search && (
<Tooltip>
<TooltipTrigger asChild>
<Button
key="clear-search"
size="tiny"
variant="text"
icon={<X />}
onClick={onClearSearch}
className="p-0 h-5 w-5"
aria-label="Clear search"
// Tooltip repeats the label; screen readers would read it twice
aria-describedby={undefined}
/>
</TooltipTrigger>
<TooltipContent side="bottom">Clear search</TooltipContent>
</Tooltip>
),
]}
/>
<div className="flex items-center gap-x-2">
<EnableCleanupButton onScheduled={onRefresh} />
<Button icon={<RefreshCw />} loading={isRefreshing} onClick={onRefresh}>
Refresh
</Button>
<Button variant="primary" onClick={onCreateJob}>
Create job
</Button>
</div>
</div>
)
}