chore(controls): add aria-label #3775

This commit is contained in:
moklick
2024-01-11 17:29:28 +01:00
parent 9c78534a49
commit c0543f9880
4 changed files with 15 additions and 3 deletions
@@ -34,6 +34,7 @@ function ControlsComponent({
className,
children,
position = 'bottom-left',
'aria-label': ariaLabel = 'React Flow controls',
}: ControlProps) {
const store = useStoreApi();
const { isInteractive, minZoomReached, maxZoomReached } = useStore(selector, shallow);
@@ -70,6 +71,7 @@ function ControlsComponent({
position={position}
style={style}
data-testid="rf__controls"
aria-label={ariaLabel}
>
{showZoom && (
<>
@@ -1,9 +1,9 @@
import type { ButtonHTMLAttributes, HTMLAttributes, ReactNode } from 'react';
import type { ButtonHTMLAttributes, ReactNode } from 'react';
import type { PanelPosition } from '@xyflow/system';
import type { FitViewOptions } from '../../types';
export type ControlProps = HTMLAttributes<HTMLDivElement> & {
export type ControlProps = {
showZoom?: boolean;
showFitView?: boolean;
showInteractive?: boolean;
@@ -14,6 +14,9 @@ export type ControlProps = HTMLAttributes<HTMLDivElement> & {
onInteractiveChange?: (interactiveStatus: boolean) => void;
position?: PanelPosition;
children?: ReactNode;
style?: React.CSSProperties;
className?: string;
'aria-label'?: string;
};
export type ControlButtonProps = ButtonHTMLAttributes<HTMLButtonElement>;