From b27aa8da2a91a4465dd2be55524cf0d107973122 Mon Sep 17 00:00:00 2001 From: Eric Olkowski Date: Wed, 17 Dec 2025 11:57:29 -0500 Subject: [PATCH 1/2] chore(ReactFlow): updated guidance for a11y --- .../content/AI/Compass/CompassReactFlowDemo.tsx | 1 + .../content/AI/Compass/ReactFlow.md | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/packages/documentation-site/patternfly-docs/content/AI/Compass/CompassReactFlowDemo.tsx b/packages/documentation-site/patternfly-docs/content/AI/Compass/CompassReactFlowDemo.tsx index a196387b29..9c28a38fb0 100644 --- a/packages/documentation-site/patternfly-docs/content/AI/Compass/CompassReactFlowDemo.tsx +++ b/packages/documentation-site/patternfly-docs/content/AI/Compass/CompassReactFlowDemo.tsx @@ -227,6 +227,7 @@ const AddNodeOnEdgeDrop = () => { fitView fitViewOptions={{ padding: 2 }} nodeOrigin={nodeOrigin} + aria-label="React flow demo" > diff --git a/packages/documentation-site/patternfly-docs/content/AI/Compass/ReactFlow.md b/packages/documentation-site/patternfly-docs/content/AI/Compass/ReactFlow.md index 2e90d2ac38..c2c35b1ff0 100644 --- a/packages/documentation-site/patternfly-docs/content/AI/Compass/ReactFlow.md +++ b/packages/documentation-site/patternfly-docs/content/AI/Compass/ReactFlow.md @@ -23,7 +23,7 @@ import { import "@xyflow/react/dist/style.css"; import "./reactFlowOverrides.css"; -### React Flow +### React Flow and PatternFly tokens 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: @@ -48,4 +48,14 @@ The React Flow package `@xyflow/react` is compatible with PatternFly through cus | --xy-handle-border-color-default | var(--pf-t--global--border--color--alt) | ```js file="./CompassReactFlowDemo.tsx" -``` \ No newline at end of file +``` + +### Accessibility considerations + +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: + +- Providing an accessible name to the `` component, if its default role of "application" is kept or if it is given another semantic role that requires an accessible name. +- 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. + - [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. +- 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. + - Dragging nodes via keyboard should be built into React Flow itself out of the box, but always double check in case. \ No newline at end of file From ca7d7aaa7f2b7c7afc2aee6567b57fcb38d3fd1e Mon Sep 17 00:00:00 2001 From: Eric Olkowski Date: Thu, 18 Dec 2025 16:20:15 -0500 Subject: [PATCH 2/2] Erin feedback --- .../content/AI/Compass/ReactFlow.md | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/packages/documentation-site/patternfly-docs/content/AI/Compass/ReactFlow.md b/packages/documentation-site/patternfly-docs/content/AI/Compass/ReactFlow.md index c2c35b1ff0..3ea682a184 100644 --- a/packages/documentation-site/patternfly-docs/content/AI/Compass/ReactFlow.md +++ b/packages/documentation-site/patternfly-docs/content/AI/Compass/ReactFlow.md @@ -52,10 +52,12 @@ The React Flow package `@xyflow/react` is compatible with PatternFly through cus ### Accessibility considerations -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: +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. -- Providing an accessible name to the `` component, if its default role of "application" is kept or if it is given another semantic role that requires an accessible name. -- 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. - - [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. -- 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. - - Dragging nodes via keyboard should be built into React Flow itself out of the box, but always double check in case. \ No newline at end of file +Additionally, you should align with the following practices: + +- Provide an accessible name to the `` component, if its default role of "application" is kept or if it is given another semantic role that requires an accessible name. +- Because React Flow supports node clicking and dragging, ensure that actions within draggable nodes are large enough to prevent misclicks (for example, kebab toggles, links, or other action buttons). + - [WCAG 2.5.8: Target size (Minimum)](https://www.w3.org/WAI/WCAG22/Understanding/target-size-minimum) requires targets to be at least 24 by 24 CSS pixels. While there are exceptions, you should still aim for this minimum because a React Flow node itself can be clicked for some actions. This is especially important for an action like opening a details drawer upon a quick click to a node. +- Ensure that any actions that can be taken via mouse only can be taken via keyboard as well, including all actions within a node and node repositioning via dragging. + - Dragging nodes via keyboard should be built into React Flow itself by default, but always double check to confirm. \ No newline at end of file