A screenshot showing the table component and sentiment selector components

Introduction

Indeed’s design system was, at first, largely developed piecemeal. It was not until later that a fully unified system was created. A key legacy of this history was a library of “community contributed” design system components. These existed in a sort of liminal space between officially supported and not really supported at all.

These components, while they generally worked for the team that had contributed them, tended to often be somewhat brittle, suffered from key accessibility flaws, and were largely a product of the fact that they were created by a specific team for a specific purpose and then largely forgotten about.

As part of the design system migration, it was decided that these components should be “graduated” to the real design system.

My Role

In building various internal tools, I had repeatedly encountered situations where I needed tables that looked like they fit into the design system. I usually ended up landing on the “community” table, which was a heavy, opinionated component built on TanStack Table. While it worked, it was not necessarily a good fit for all situations, and was a bit quirky. There was also a second, “basic” table component which was also opinionated in some other ways.

There had previously been proposals to bring a proper table component to the design system, going back as far as 3 years, but ultimately these fizzled out for various reasons. However, with the new “graduation” effort, I could see this was the chance to finally give the Table the place at the table it deserved.

To do this, I iterated heavily using AI tooling to manage a spec document and a living component. As I collected feedback from engineering and designers on the document, I could both update the document and the test component in real-time. Inspired by many other modern stateless table components (such as in FluentUI), I put together a finalized proposal for a stateless, accessible table capable of performing all the functions of both pre-existing table components.

Data Table & Accessibility (WAI-ARIA)

A screenshot showing the table component
<Table selectionType="multiple">
    <TableHead>
        <TableRow>
            <TableSelectionColumnHeader
                checked={isAllSelected}
                indeterminate={isIndeterminate}
                onInputChange={toggleAll}
                aria-label="Select all candidates"
            />
            <TableColumnHeader sortDirection={sortDir} onSortChange={handleSort}>
                Candidate
            </TableColumnHeader>
            {/* Role, Status... */}
        </TableRow>
    </TableHead>
    <TableBody>
        {rows.map((row) => (
            <TableRow key={row.id} selected={row.selected}>
                <TableSelectionCell
                    checked={row.selected}
                    onInputChange={() => toggleRow(row.id)}
                    aria-label={`Select ${row.name}`}
                />
                <TableCell>{row.name}</TableCell>
                {/* ... */}
            </TableRow>
        ))}
    </TableBody>
</Table>

Even as far as the earlier proposals floated 3 years prior, the idea of a more “foundational” table built around HTML Table primitives had come up. I believed this was definitely the right approach; after all, it’s the classic, it’s semantically correct, and you get accessibility basically for free.

This contrasts with how the older “basic table” and “advanced table” components worked, each of which accepted data via parameters in different, incompatible ways. In addition, each had its own oddities, such as “basic table’s” default behavior of restructuring itself as a list on smaller viewports, and “advanced table”’s long non-optional array of “accessibility strings” that it would use as aria-labels for various parts of the table.

That said, I wanted to encompass as much available functionality as possible, so there were a few things that were a bit tricky to get right. After quite a bit of iteration, I was able to land on an API that was intended to be both highly readable and support everything you might want to do with a table. Furthermore, it was completely accessible, and did so without strange laundry lists of strings; aria-labels are always put where they logically should be.

Selection Modes

The previous “advanced” table allowed tricks like selection mode (checkboxes or radios), though these could be a bit buggy due to internal selection state handling. By switching to using standard controls internally, the new selection cell API would simply create standard radio or checkbox controls, with all the keyboard semantics you’d expect. For example, in “single” selection mode, you got radio buttons that could be controlled with the arrow keys just like all standard radios.

Clickable Rows

To add to this, clickable full-row actions became fully supported. On the previous table components, it could be quite tempting to just stick an onClick onto the row, which often resulted in inaccessible behavior, since an element with an onClick does not have all the other interactive element semantics you might want it to have. (For example, it often wouldn’t be keyboard focusable, etc.) To support this in an accessible way, I added a system where clicking on a row can trigger a configurable target within it, thus making the clickable row simply a bonus way to access for a real control that has proper interactivity behavior, such as a button, etc. To make it even easier for devs, this behavior is enabled automatically for selection tables. (But don’t worry, you can turn it off – it is fully controllable!)

Additional Migrated Components

A screenshot showing the sentiment selector component

After the table, I also migrated a sentiment selector. This one was previously implemented as an absolutely bizarre combination of form controls and buttons, including a hidden submit button that would only appear if keyboard navigation was detected. I replaced it with standard radio buttons internally, so that screen readers, keyboards, etc, just work™.

Remember kids, with web accessibility, the simplest solution is probably the best one.

Outcome

In the end, the new components were adopted by more than 35 projects, with more each time I check. One day, I hope to see the last of the three older components, and thusly shall the circle of life be completed!