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();
|
||||
|
||||
store.setState({
|
||||
ariaLiveMessage:
|
||||
labelConfig['a11yDescription.ariaLiveMessage']?.(
|
||||
event.key.replace('Arrow', '').toLowerCase(),
|
||||
~~internals.positionAbsolute.x,
|
||||
~~internals.positionAbsolute.y
|
||||
) || '',
|
||||
ariaLiveMessage: labelConfig['a11yDescription.ariaLiveMessage'](
|
||||
event.key.replace('Arrow', '').toLowerCase(),
|
||||
~~internals.positionAbsolute.x,
|
||||
~~internals.positionAbsolute.y
|
||||
),
|
||||
});
|
||||
|
||||
moveSelectedNodes({
|
||||
|
||||
@@ -668,8 +668,8 @@ export interface ReactFlowProps<NodeType extends Node = Node, EdgeType extends E
|
||||
*/
|
||||
debug?: boolean;
|
||||
/**
|
||||
* Custom accessibility messages for screen readers and a11y features.
|
||||
* Allows localization and customization of ARIA descriptions.
|
||||
* Configuration for customizable labels, descriptions, and UI text. Provided keys will override the corresponding defaults.
|
||||
* 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
|
||||
event.preventDefault();
|
||||
store.ariaLiveMessage = labelConfig['a11yDescription.ariaLiveMessage']?.(
|
||||
store.ariaLiveMessage = labelConfig['a11yDescription.ariaLiveMessage'](
|
||||
event.key.replace('Arrow', '').toLowerCase(),
|
||||
~~node.internals.positionAbsolute.x,
|
||||
~~node.internals.positionAbsolute.y
|
||||
) || '';
|
||||
),
|
||||
|
||||
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 */
|
||||
onselectionend?: (event: PointerEvent) => void;
|
||||
/**
|
||||
* Custom accessibility messages for screen readers and a11y features.
|
||||
* Allows localization and customization of ARIA descriptions.
|
||||
* Configuration for customizable labels, descriptions, and UI text. Provided keys will override the corresponding defaults.
|
||||
* Allows localization, customization of ARIA descriptions, control labels, minimap labels, and other UI strings.
|
||||
*/
|
||||
labelConfig?: LabelConfig;
|
||||
};
|
||||
|
||||
@@ -58,4 +58,4 @@ export const defaultLabelConfig = {
|
||||
'minimap.ariaLabel': 'Mini Map',
|
||||
};
|
||||
|
||||
export type LabelConfig = Partial<typeof defaultLabelConfig>;
|
||||
export type LabelConfig = Required<typeof defaultLabelConfig>;
|
||||
|
||||
Reference in New Issue
Block a user