Repository navigation
Let authors choose which columns a filterable table offers as dropdowns - #4915
Open
nastasha-solomon wants to merge 8 commits into
Open
nastasha-solomon wants to merge 8 commits into
nastasha-solomon wants to merge 8 commits into
Conversation
`:filterable:` offers a dropdown for every column with 2 to 12 distinct values. Columns of scores or counts qualify, so a table like the Security LLM performance matrix gets a stack of exact-match score dropdowns. `:filterable: search` keeps the search box and count without dropdowns. `:filter-columns:` names the columns that get one, matched by header text, and skips the distinct-value cap and key-column check for those columns. An unknown column name is a build error. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
Docs preview (local build)Handbook preview: https://docs-v3-preview.elastic.dev/elastic/docs-builder/pull/4915/ Sample changed pages: |
The build and the browser each worked out header text, in different ways, so a header could pass the build check and still get no dropdown, or fail the check while matching what readers see. The build now matches :filter-columns: names against the text readers see (substitution values, decoded entities, no footnote markers, collapsed whitespace) and renders the matched column positions. The browser filters by position and never compares header text. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
nastasha-solomon
force-pushed
the
filterable-table-column-control
branch
from
November 18, 2026 01:05
48081a7 to
8148e2d
Compare
This was referenced Nov 18, 2026
The browser's own arrow on the filter dropdowns sat against the right border, so it looked like it was falling out of the control. The dropdowns now hide the native arrow and draw a thin chevron inset from the edge, with padding to keep the value clear of it. It's drawn in the text color, so it follows the design system's dark themes too. Both the legacy and the design-system stylesheets get the change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Member
Author
Forced-colors mode (Windows High Contrast) drops gradient background images, so the drawn chevron vanished and the filter dropdowns looked like plain text boxes. In that mode the dropdowns now go back to the browser's own arrow and padding, in both stylesheets. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #4914.
Summary
Writers can already add a search box and filter dropdowns to a table with the
:filterable:option. Today, docs-builder decides on its own which columns get a dropdown. This PR lets the writer make that choice, with two new options::filterable: searchshows the search box and nothing else.:filter-columns:names the columns that get a dropdown. No other column gets one.Tables that already use
:filterable:work exactly as they do today. The one visible change is the arrow on each filter dropdown, which now sits inset from the border instead of against it. The controls above filterable tables are reworked separately in #4920, which is stacked on this PR.The problem
docs-builder adds a dropdown to every column that has between 2 and 12 different values. That's right for a column like Type or Status. It's wrong for a column of scores, which also has only a few different values.
The Security LLM performance matrix (elastic/docs-content#9483) shows the problem. Each row is a model, and most columns are scores from 1 to 10. The table gets seven score dropdowns, stacked in four rows above the table. Each dropdown matches one exact score, such as "9.00". A reader comparing models doesn't filter that way, and the writer had no way to remove them.
Option 1: a search box with no dropdowns
Add
searchafter:filterable:::::{table} :filterable: searchReaders get the search box and the "Showing N of M" count. Typing narrows the table to the rows that contain the text, in any column.
Option 2: choose which columns get a dropdown
List the columns by their header text, separated by commas:
:::{table} :filterable: :filter-columns: ProviderOnly the listed columns get a dropdown. In this example, the writer also split the model name into Provider and Model columns, so readers can compare one provider's models.
This recording shows the Provider dropdown and the search box working together:
6-filter-columns-provider-demo.webm
A few details about matching column names:
support statusmatches a Support status header.{{es}} version, matches the variable's value. You writeElasticsearch version.Mistakes the build catches
:filter-columns:name that matches no column header:filterable:other thansearch,true, orfalse:filter-columns:without:filterable::filterable: searchand:filter-columns:Before this change, a value like
:filterable: yesturned filtering off without any message. It's now an error. No page in docs-content uses a value with:filterable:, so nothing breaks.Try it
The docs preview for this PR has working examples of both options under Choose which columns get dropdown filters:
https://docs-v3-preview.elastic.dev/elastic/docs-builder/pull/4915/syntax/tables#choose-which-columns-get-dropdown-filters
How the screenshots were made
The screenshots and recording use the live preview of elastic/docs-content#9483, with its real styles and data. The new filter code from this branch replaces the old code on the page. For Option 2, a script also split the Model column into Provider and Model to stand in for the docs-content change a writer would make.
Technical details for reviewers
Server side
TableDirectiveBlockreads:filterable:itself instead of throughPropBool, which treated any value other thantrueasfalse. It accepts no value,true,false, orsearch.:filterable: searchrenders<filterable-table data-facets="none">.:filter-columns: A, Bis matched against the header row at render time, next to the existing column-width check, because Markdig turns the paragraph into a table only after the directive closes. The build renders the matched columns' zero-based positions, such as<filterable-table data-facet-columns="1,2">, so header text is compared only on the server.Client side
FilterableTable.tsreads the two data attributes. Withdata-facets="none"it builds no dropdowns. Withdata-facet-columnsit builds dropdowns only for the columns at the listed positions, and skips the 12-value cap and the key-column check for them.CSS
appearance: noneand draw a thin chevron with twolinear-gradientlines incurrentColor, inset from the right edge, with extra right padding so the value stays clear of it. Using the text color means it follows the design system's light and dark themes. The change is in bothAssets/markdown/table.cssand the design-systemComponents/Markdown/Table/table.css.Tests
Eight new tests, under "filterable-table author-chosen dropdowns", cover the default behavior, search only, listed columns, table order, a key column, the lifted cap, a header with a footnote and extra spaces, and a position that isn't a number.
Nine new test classes cover search only, the unknown-column error, case and emphasis matching, headers with a footnote, a substitution, or extra spaces, an invalid value, a missing
:filterable:, and the conflicting options.The vitest suite,
tsc, ESLint, Prettier, andcurb checkpass locally. The C# tests weren't run locally, because this machine has .NET SDK 10 andglobal.jsonrequires 11.🤖 Generated with Claude Code