Skip to content

Commit bcec348

Browse files
committed
chore(ReactFlow): updated guidance for a11y
1 parent 064b9ba commit bcec348

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

packages/documentation-site/patternfly-docs/content/AI/Compass/CompassReactFlowDemo.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,7 @@ const AddNodeOnEdgeDrop = () => {
227227
fitView
228228
fitViewOptions={{ padding: 2 }}
229229
nodeOrigin={nodeOrigin}
230+
aria-label="React flow demo"
230231
>
231232
<Background />
232233
</ReactFlow>

packages/documentation-site/patternfly-docs/content/AI/Compass/ReactFlow.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import {
2323
import "@xyflow/react/dist/style.css";
2424
import "./reactFlowOverrides.css";
2525

26-
### React Flow
26+
### React Flow and PatternFly tokens
2727

2828
The React Flow package `@xyflow/react` is compatible with PatternFly through customization of its [theme](https://reactflow.dev/learn/customization/theming) and [rendered nodes](https://reactflow.dev/learn/customization/custom-nodes). A custom override stylesheet can assign PatternFly's global tokens to React Flow's own tokens to ensure a consistent styling. The following is a basic list of overrides used by the example, which also renders custom nodes using PatternFly's `Card` components:
2929

@@ -48,4 +48,14 @@ The React Flow package `@xyflow/react` is compatible with PatternFly through cus
4848
| --xy-handle-border-color-default | var(--pf-t--global--border--color--alt) |
4949

5050
```js file="./CompassReactFlowDemo.tsx"
51-
```
51+
```
52+
53+
### Accessibility considerations
54+
55+
While React Flow is built with accessibility in mind, you should always check that your implementation when paired with PatternFly is accessible via mouse, keyboard, and other assistive technologies like screen readers. Some things to keep in mind include:
56+
57+
- Providing an accessible name to the `<ReactFlow>` component, if its default role of "application" is kept or if it is given another semantic role that requires an accessible name.
58+
- Due to the nature of React Flow and howw you are able to click and drag nodes, if your draggable nodes contain other actions inside of them (kebab toggles, links, other action buttons), you should ensure those actions are large enough to prevent misclicks.
59+
- [WCAG 2.5.8 - Target size (Minimum)](https://www.w3.org/WAI/WCAG22/Understanding/target-size-minimum) requires at least 24z24 CSS pixels. While they also state exceptions, because a React Flow node itself can be clicked for some action, you should aim for sticking to this minimum, especially if implementing an action where clicking a node quickly can open a details drawer.
60+
- In general ensure that any actions that can be taken via mouse only can be taken via keyboard as well, whether that be actions inside a node or being able to drag a node around to reposition it.
61+
- Dragging nodes via keyboard should be built into React Flow itself out of the box, but always double check in case.

0 commit comments

Comments
 (0)