diff --git a/packages/react/src/additional-components/Controls/Controls.tsx b/packages/react/src/additional-components/Controls/Controls.tsx index 3a38790d..5cb9bb4f 100644 --- a/packages/react/src/additional-components/Controls/Controls.tsx +++ b/packages/react/src/additional-components/Controls/Controls.tsx @@ -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 && ( <> diff --git a/packages/react/src/additional-components/Controls/types.ts b/packages/react/src/additional-components/Controls/types.ts index 3833c50f..e687b09b 100644 --- a/packages/react/src/additional-components/Controls/types.ts +++ b/packages/react/src/additional-components/Controls/types.ts @@ -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 & { +export type ControlProps = { showZoom?: boolean; showFitView?: boolean; showInteractive?: boolean; @@ -14,6 +14,9 @@ export type ControlProps = HTMLAttributes & { onInteractiveChange?: (interactiveStatus: boolean) => void; position?: PanelPosition; children?: ReactNode; + style?: React.CSSProperties; + className?: string; + 'aria-label'?: string; }; export type ControlButtonProps = ButtonHTMLAttributes; diff --git a/packages/svelte/src/lib/plugins/Controls/Controls.svelte b/packages/svelte/src/lib/plugins/Controls/Controls.svelte index 396d19dd..a82c7c03 100644 --- a/packages/svelte/src/lib/plugins/Controls/Controls.svelte +++ b/packages/svelte/src/lib/plugins/Controls/Controls.svelte @@ -21,6 +21,7 @@ export let buttonColor: $$Props['buttonColor'] = undefined; export let buttonColorHover: $$Props['buttonColorHover'] = undefined; export let buttonBorderColor: $$Props['buttonColorHover'] = undefined; + export let ariaLabel: $$Props['aria-label'] = undefined; const { zoomIn, @@ -67,7 +68,12 @@ }; - + {#if showZoom}