Merge pull request #2545 from wbkd/feat/minimap-aria-label
Add prop to configure the MiniMap title
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@reactflow/minimap': minor
|
||||
---
|
||||
|
||||
add a new property "ariaLabel" to configure or remove the aria-label of the minimap component
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user