chore: make labelConfig items required, update description text
This commit is contained in:
@@ -144,12 +144,11 @@ export function NodeWrapper<NodeType extends Node>({
|
|||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
||||||
store.setState({
|
store.setState({
|
||||||
ariaLiveMessage:
|
ariaLiveMessage: labelConfig['a11yDescription.ariaLiveMessage'](
|
||||||
labelConfig['a11yDescription.ariaLiveMessage']?.(
|
event.key.replace('Arrow', '').toLowerCase(),
|
||||||
event.key.replace('Arrow', '').toLowerCase(),
|
~~internals.positionAbsolute.x,
|
||||||
~~internals.positionAbsolute.x,
|
~~internals.positionAbsolute.y
|
||||||
~~internals.positionAbsolute.y
|
),
|
||||||
) || '',
|
|
||||||
});
|
});
|
||||||
|
|
||||||
moveSelectedNodes({
|
moveSelectedNodes({
|
||||||
|
|||||||
@@ -668,8 +668,8 @@ export interface ReactFlowProps<NodeType extends Node = Node, EdgeType extends E
|
|||||||
*/
|
*/
|
||||||
debug?: boolean;
|
debug?: boolean;
|
||||||
/**
|
/**
|
||||||
* Custom accessibility messages for screen readers and a11y features.
|
* Configuration for customizable labels, descriptions, and UI text. Provided keys will override the corresponding defaults.
|
||||||
* Allows localization and customization of ARIA descriptions.
|
* Allows localization, customization of ARIA descriptions, control labels, minimap labels, and other UI strings.
|
||||||
*/
|
*/
|
||||||
labelConfig?: LabelConfig;
|
labelConfig?: Partial<LabelConfig>;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -189,11 +189,11 @@
|
|||||||
) {
|
) {
|
||||||
// prevent default scrolling behavior on arrow key press when node is moved
|
// prevent default scrolling behavior on arrow key press when node is moved
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
store.ariaLiveMessage = labelConfig['a11yDescription.ariaLiveMessage']?.(
|
store.ariaLiveMessage = labelConfig['a11yDescription.ariaLiveMessage'](
|
||||||
event.key.replace('Arrow', '').toLowerCase(),
|
event.key.replace('Arrow', '').toLowerCase(),
|
||||||
~~node.internals.positionAbsolute.x,
|
~~node.internals.positionAbsolute.x,
|
||||||
~~node.internals.positionAbsolute.y
|
~~node.internals.positionAbsolute.y
|
||||||
) || '';
|
),
|
||||||
|
|
||||||
store.moveSelectedNodes(arrowKeyDiffs[event.key], event.shiftKey ? 4 : 1);
|
store.moveSelectedNodes(arrowKeyDiffs[event.key], event.shiftKey ? 4 : 1);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -473,8 +473,8 @@ export type SvelteFlowProps<
|
|||||||
/** This event handler gets called when the user finishes dragging a selection box */
|
/** This event handler gets called when the user finishes dragging a selection box */
|
||||||
onselectionend?: (event: PointerEvent) => void;
|
onselectionend?: (event: PointerEvent) => void;
|
||||||
/**
|
/**
|
||||||
* Custom accessibility messages for screen readers and a11y features.
|
* Configuration for customizable labels, descriptions, and UI text. Provided keys will override the corresponding defaults.
|
||||||
* Allows localization and customization of ARIA descriptions.
|
* Allows localization, customization of ARIA descriptions, control labels, minimap labels, and other UI strings.
|
||||||
*/
|
*/
|
||||||
labelConfig?: LabelConfig;
|
labelConfig?: LabelConfig;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -58,4 +58,4 @@ export const defaultLabelConfig = {
|
|||||||
'minimap.ariaLabel': 'Mini Map',
|
'minimap.ariaLabel': 'Mini Map',
|
||||||
};
|
};
|
||||||
|
|
||||||
export type LabelConfig = Partial<typeof defaultLabelConfig>;
|
export type LabelConfig = Required<typeof defaultLabelConfig>;
|
||||||
|
|||||||
Reference in New Issue
Block a user