Skip to content

Make filterable table controls easier to use - #4920

Open
nastasha-solomon wants to merge 9 commits into
filterable-table-column-controlfrom
filterable-table-controls
Open

nastasha-solomon wants to merge 9 commits into
filterable-table-column-controlfrom
filterable-table-controls

Conversation

@nastasha-solomon

@nastasha-solomon nastasha-solomon commented Nov 18, 2026 •

Copy link
Copy Markdown
Member

Fixes #4919.

Note

This PR is stacked on #4915, and its base branch is #4915's branch. After #4915 merges, change the base to main.

Summary

This PR reworks the controls above every :filterable: table so they stay out of the way until readers need them. The search box gets its own row, the dropdowns collapse behind a Filters button that counts the filters that are on, a Clear button resets everything, and an empty table explains why it's empty.

Authors don't need to change anything. Every filterable table gets the new controls, with the same search and the same dropdowns as before.

The problem

The search box, the dropdowns, and the count shared one wrapping row. With several dropdowns, the search box got squeezed, the controls wrapped unevenly, and they pushed the table's data down the page. This is the Security LLM performance matrix with its seven automatic dropdowns:

1-before-auto-dropdowns

Readers also couldn't tell at a glance which filters were on, had to undo each filter one at a time, and saw only a header row when nothing matched.

The new controls

The search box gets its own row

The search box spans the row, with a Filters button beside it. The dropdowns no longer take space from it.

Dropdowns start collapsed behind a Filters button

Readers see the table first. Filters opens the dropdowns, lined up in equal columns, each with its label above it. They wrap into fewer columns on narrow screens.

The button shows how many filters are on, even with the panel closed, so readers can always tell the table is narrowed. On a table with no dropdowns, such as one with :filterable: search, the button doesn't appear.

Collapsed (the default) Collapsed, with one filter on
8-filters-collapsed 9-filters-collapsed-with-count
Open Open, with OpenAI selected
4-filter-columns-provider 5-filter-columns-provider-openai

Active filters stand out

A dropdown that isn't set to All gets a blue border, so readers can see which filters are narrowing the table without reading every dropdown.

One button resets everything

While a search or filter is set, a Clear button appears next to the "Showing N of M" count. It empties the search box, sets every dropdown back to All, and moves the cursor back to the search box.

An empty table says why

When nothing matches, a message appears under the header row and names what's narrowing the table: "No rows match your search.", "No rows match your filters.", or "No rows match your search and filters."

7-no-results

This recording shows the controls in use:

6-filter-columns-provider-demo.webm

What stays the same

  • Which columns get dropdowns, and how search and dropdowns combine.
  • The count, which still announces "Showing N of M" to screen readers.
  • Printing: the search box, the Filters button, the dropdowns, and Clear don't print. The count and the no-results message print when rows are hidden.

Try it

The docs preview for this PR has working examples under Filterable table:
https://docs-v3-preview.elastic.dev/elastic/docs-builder/pull/4920/syntax/tables#filterable-table

How the screenshots were made

The screenshots and recording use the live preview of elastic/docs-content#9483, with its real styles and data. This branch's filter code and controls CSS replace the old ones on the page. A script also split the Model column into Provider and Model, and set the table to filter by Provider with #4915's :filter-columns:.

Technical details for reviewers

Markup

  • The controls are three containers: .filterable-table-search-row (the search input and a .filterable-table-toggle button), .filterable-table-facets (a CSS grid of label.filterable-table-facet, each with a .filterable-table-facet-label above its select), and .filterable-table-summary (the status and a .filterable-table-clear button).
  • The search and select class names are unchanged, so the fullscreen copy of the filter state still finds them.

Behavior

  • The Filters button is a disclosure button: aria-expanded, and aria-controls pointing at the panel, which gets a unique id. The panel starts hidden. The button shows a count badge of the dropdowns that aren't All, and its accessible name becomes "Filters, N on". It's hidden when the table has no dropdowns.
  • applyFilters sets data-active on each dropdown that isn't All and shows Clear only while a search or filter is set. Clearing resets everything and moves focus back to the search box.
  • When no rows match, applyFilters sets data-empty on the host and shows a div.filterable-table-empty after the table. It's a div because the page's paragraph styles would add a top margin to a p. It isn't a live region, because the count already announces "Showing 0 of N". A fullscreen copy is cloned from an enhanced host, so the component removes a carried-over message before adding its own.
  • The fullscreen copy carries the filter values, so its badge is right, but its panel starts collapsed. I haven't tested the fullscreen view, because my previews don't load the script that runs it.

Tests

cd src/Elastic.Documentation.Site && npx vitest run Assets/web-components/FilterableTable.test.ts

Sixteen new tests, in three groups:

  • "filterable-table control layout" covers the row order, when Clear shows, the active-dropdown marker, and resetting everything.
  • "filterable-table empty results" covers the Clear label, the message for a search, filters, or both, hiding it after Clear, and a cloned host keeping one message.
  • "filterable-table collapsible filters" covers starting collapsed, opening and closing, the badge and accessible name, unique panel ids, and no button on search-only tables.

The vitest suite, tsc, ESLint, and Prettier pass locally.

🤖 Generated with Claude Code

nastasha-solomon and others added 6 commits November 17, 2026 19:40
The search box, the dropdowns, and the count shared one wrapping row, so
each new dropdown squeezed the search box and the rows wrapped unevenly.

The controls now have three rows: the search box on its own, the dropdowns
in an equal-width grid with their labels above them, and the count. A
"Clear filters" button appears next to the count while anything is
filtered, and a dropdown that's narrowing the table gets a highlighted
border.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A search or filter that matched nothing left only the header row, which
looked like a broken table. A message now appears under the header row,
naming what's narrowing the table: the search, the filters, or both. It
isn't a live region, because the count already announces "Showing 0 of N".

The reset button is now labeled "Clear", which also fits search-only tables.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Five dropdowns take several rows above a table before any data shows. The
dropdowns now start collapsed behind a "Filters" button beside the search
box. The button shows how many filters are on, visibly and in its
accessible name, so readers can tell the table is narrowed with the panel
shut. It's a disclosure button with aria-expanded and aria-controls, and
it's hidden when the table has no dropdowns.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
nastasha-solomon and others added 2 commits November 17, 2026 20:25
… into filterable-table-controls

# Conflicts:
#	src/Elastic.Documentation.Site/Assets/markdown/table.css
With NAVIGATION_PREVIEW on, pages load ds.css instead of styles.css, and
ds.css takes its table styles from Components/Markdown/Table/table.css.
That file still styled the old one-row controls, so the new search row,
the Filters button, the dropdown grid, Clear, and the no-results message
were unstyled there, and the print rules didn't hide the new buttons.

The design-system stylesheet now carries the same controls, written with
its tokens so they follow its light and dark themes. The Filters button's
icons also get width and height attributes, because the design-system
reset makes SVGs block-level with no size of their own.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@nastasha-solomon

Copy link
Copy Markdown
Member Author

This PR is part of a group of related table improvements:

PR Issue What it adds Base
#4915 #4914 :filterable: search, :filter-columns:, the inset dropdown arrow main
#4918 #4917 :pin-first-column: main
#4920 #4919 Easier filter controls #4915
#4922 #4921 Filterable prebuilt rules table #4915

… into filterable-table-controls

# Conflicts:
#	src/Elastic.Documentation.Site/Components/Markdown/Table/table.css

This branch was successfully deployed

1 active deployment
assembler-preview — d4a74285 Deployed Nov 18, 2026 by github-actions[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant