Merge pull request #2545 from wbkd/feat/minimap-aria-label

Add prop to configure the MiniMap title
This commit is contained in:
Moritz Klack
2022-11-15 11:04:29 +01:00
committed by GitHub
3 changed files with 8 additions and 2 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@reactflow/minimap': minor
---
add a new property "ariaLabel" to configure or remove the aria-label of the minimap component
+2 -2
View File
@@ -38,7 +38,6 @@ const selector = (s: ReactFlowState) => {
const getAttrFunction = (func: any): GetMiniMapNodeAttribute => (func instanceof Function ? func : () => func);
const ARIA_LABEL_KEY = 'react-flow__minimap-desc';
function MiniMap({
style,
className,
@@ -53,6 +52,7 @@ function MiniMap({
onNodeClick,
pannable = false,
zoomable = false,
ariaLabel = 'React Flow mini map',
}: MiniMapProps) {
const store = useStoreApi();
const svg = useRef<SVGSVGElement>(null);
@@ -155,7 +155,7 @@ function MiniMap({
ref={svg}
onClick={onSvgClick}
>
<title id={labelledBy}>React Flow mini map</title>
{ariaLabel && <title id={labelledBy}>{ariaLabel}</title>}
{nodes.map((node) => {
return (
<MiniMapNode
+1
View File
@@ -16,4 +16,5 @@ export type MiniMapProps<NodeData = any> = Omit<HTMLAttributes<SVGSVGElement>, '
onNodeClick?: (event: MouseEvent, node: Node<NodeData>) => void;
pannable?: boolean;
zoomable?: boolean;
ariaLabel?: string | null;
};