chore(a11y): cleanup
This commit is contained in:
@@ -36,18 +36,15 @@ function AriaLiveMessage({ rfId }: { rfId: string }) {
|
||||
export function A11yDescriptions({ rfId, disableKeyboardA11y }: { rfId: string; disableKeyboardA11y: boolean }) {
|
||||
const labelConfig = useStore(labelConfigSelector);
|
||||
|
||||
const nodeDesc = disableKeyboardA11y
|
||||
? labelConfig['a11yDescription.node.default']
|
||||
: labelConfig['a11yDescription.node.keyboardDisabled'];
|
||||
const edgeDesc = labelConfig['a11yDescription.edge.default'];
|
||||
|
||||
return (
|
||||
<>
|
||||
<div id={`${ARIA_NODE_DESC_KEY}-${rfId}`} style={style}>
|
||||
{nodeDesc}
|
||||
{disableKeyboardA11y
|
||||
? labelConfig['a11yDescription.node.default']
|
||||
: labelConfig['a11yDescription.node.keyboardDisabled']}
|
||||
</div>
|
||||
<div id={`${ARIA_EDGE_DESC_KEY}-${rfId}`} style={style}>
|
||||
{edgeDesc}
|
||||
{labelConfig['a11yDescription.edge.default']}
|
||||
</div>
|
||||
{!disableKeyboardA11y && <AriaLiveMessage rfId={rfId} />}
|
||||
</>
|
||||
|
||||
@@ -40,7 +40,7 @@ export function NodeWrapper<NodeType extends Node>({
|
||||
nodeClickDistance,
|
||||
onError,
|
||||
}: NodeWrapperProps<NodeType>) {
|
||||
const { node, internals, isParent, labelConfig } = useStore((s) => {
|
||||
const { node, internals, isParent } = useStore((s) => {
|
||||
const node = s.nodeLookup.get(id)! as InternalNode<NodeType>;
|
||||
const isParent = s.parentLookup.has(id);
|
||||
|
||||
@@ -48,7 +48,6 @@ export function NodeWrapper<NodeType extends Node>({
|
||||
node,
|
||||
internals: node.internals,
|
||||
isParent,
|
||||
labelConfig: s.labelConfig,
|
||||
};
|
||||
}, shallow);
|
||||
|
||||
@@ -143,6 +142,8 @@ export function NodeWrapper<NodeType extends Node>({
|
||||
// prevent default scrolling behavior on arrow key press when node is moved
|
||||
event.preventDefault();
|
||||
|
||||
const { labelConfig } = store.getState();
|
||||
|
||||
store.setState({
|
||||
ariaLiveMessage: labelConfig['a11yDescription.ariaLiveMessage']({
|
||||
direction: event.key.replace('Arrow', '').toLowerCase(),
|
||||
|
||||
Reference in New Issue
Block a user