React Arborist – A full-featured tree component for React
github.com
github.com
W3C has some in-depth list of expected keyboard interactions, though I'm not sure how complete they are:
https://w3c.github.io/aria-practices/#TreeView
https://w3c.github.io/aria-practices/examples/treeview/treev...
I ask because I've tried to implement a [TreeGrid](https://w3c.github.io/aria-practices/#treegrid) myself before and... it's a lot of work. I'd love an accessible, keyboard-friendly React tree :).
"React Aria provides accessibility and behavior according to WAI-ARIA Authoring Practices, including full screen reader and keyboard navigation support. All components have been tested across a wide variety of screen readers and devices to ensure the best experience possible for all users."
(I know you’re arguing against someone claiming 100% accessibility coverage as a requirement, but I wanted to point out that figures like 98.8% are grossly inflated and quite meaningless.)
That said, the entire accessibility scene is fundamentally broken on the technical side and full of snake oil salesmen on the business side.
Anxiously waiting for WCAG to finish an actual standard, and for vendors to actually implement it.
Typically devs will also ignore reader shortcuts and instead use tab navigation, which is not how screen reader users do things because it bypasses screen reader navigation altogether.
Do you know for a fact that the ”false” positives weren’t actual problems for someone using NVDA or JAWS shortcuts to navigate on Firefox on Windows, or some other combination of reader + navigation + browser + OS?
Everything is broken and nobody can test or fix everything.
If that's the standard for open-source projects, it's a wonder any FE components get used
100% is not hyperbole, even though ”not exist” is.
100% “accessible” is meaningless: full adherence to what standard? 2.1 AA? That’s an incredibly high bar, and would require constant vigilance and expensive audits on a rotating basis. Much of the guidelines are up for interpretation and can’t easily be expressed in a binary pass/fail besides.
My favorite is the Tree Table
My first thought - how React Arborist is different from Ant Tree? https://ant.design/components/tree/
React Arborist dependencies looks sane https://github.com/brimdata/react-arborist/blob/main/package...
"memoize-one": "^6.0.0", "react-dnd": "^14.0.3", "react-dnd-html5-backend": "^14.0.1", "react-window": "^1.8.6"
However I was never a fan of react-dnd. Extremely hard to reason about react-dnd-html5-backend and spagetti code once you face edge scenarios.
Hard coded css means I need to fork the library
https://github.com/brimdata/react-arborist/blob/main/package...
const style: CSSProperties = {
position: "absolute",
pointerEvents: "none",
top: top - 2 + "px",
left: treeView.indent + left + "px",
right: treeView.indent + "px",
};I agree that the hard-coded DefaultCursor styles need to be configurable. I'll soon update. You'll be able to pass in your own component to render the DropCursor (blue line indicating the new position of the node you're dragging).
Jokes apart, nice library. Will try it out sooner or later. May I suggest to not use children as the prop to Ps the Node component? Maybe a more explicit NodeComponent prop would have been better imho.
This is the approach used by most headless projects such has headless ui or radix.
Hey, since you get to decide the structure yourself, I’m sure you could use that to draw a real tree using SVG.
https://github.com/mozilla/gecko-dev/tree/master/devtools/cl...
It's based on React, but also uses require.js for its dependencies from other parts of Devtools, like TreeView - so it looks tough to separate into an independent component.
I was thinking of making a generic tree manager class to provide basic functions (move, rename, add, delete) for managing the tree data structure in the parent component. Maybe I'll call it "Arborist"!
<Tree children={Node} />