Skip to content

Show facet option for the first column on view pages - #2810

Merged
simonw merged 5 commits into
simonw:mainfrom
cycsmail:first-column-facet-2045
Nov 22, 2026
Merged

simonw merged 5 commits into
simonw:mainfrom
cycsmail:first-column-facet-2045

Conversation

@cycsmail

@cycsmail cycsmail commented Jun 26, 2026 •

Copy link
Copy Markdown
Contributor

Closes:

The cog menu was hiding "Facet by this" on the first column of a view. The check used a positional th:first-of-type heuristic to skip the special row-link column, but on a view the first column is a real data column so it got skipped too.

Switched it to key off the data-is-link-column attribute the template already sets for the special link column (the same thing hasMultipleVisibleColumns and the mobile column menu already use), so the link column is still skipped but a view's first column now gets the facet option.

Added a test that drives buildColumnActionItems via node against a minimal fake DOM: the first column of a view now offers faceting, while the link column and a single pk still don't.

@cycsmail

Copy link
Copy Markdown
Contributor Author

just checking in on this one, all checks are green. happy to rebase or tweak anything if that makes it easier to review.

@simonw simonw added the bug label Nov 22, 2026
@simonw simonw added this to the Datasette 1.0 stable milestone Nov 22, 2026
@simonw

simonw commented Nov 22, 2026

Copy link
Copy Markdown
Owner

Looks good! I'm going to replace the test with a playwright test.

simonw and others added 3 commits November 22, 2026 15:32
# Conflicts:
#	tests/test_table_html.py
Replaces the test that ran table.js in Node against a fake DOM with a
Playwright test that opens the column menu on real pages: the first
column of a view offers "Facet by this" and faceting by it works, the
primary key of a single primary key table does not offer it, and the
link column of a compound primary key table has no menu at all.

Refs simonw#2045

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@simonw
simonw merged commit 2a23e09 into simonw:main Nov 22, 2026
14 checks passed
@codecov

codecov Bot commented Nov 22, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 0.00%. Comparing base (8c91973) to head (279d830).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@          Coverage Diff          @@
##            main   #2810   +/-   ##
=====================================
  Coverage   0.00%   0.00%           
=====================================
  Files         81      81           
  Lines      14762   14762           
=====================================
  Misses     14762   14762           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

simonw added a commit that referenced this pull request Nov 23, 2026
…upgrade guide sections

Release notes for the null, empty string and binary primary key work
(#3112), the SpatiaLite KNN count fix (#1611), the insert API fixes
(#3081) and the first column facet on views (#2810), which landed
without any. The summary paragraph now mentions primary keys and view
filters.

New upgrade guide sections for datasette.urls.modify(), keyword-only
arguments, format_bytes(), TestClient and primary key values, linked
from their changelog entries.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants