diff --git a/notes/pdftract-5ec94.md b/notes/pdftract-5ec94.md new file mode 100644 index 0000000..85f4458 --- /dev/null +++ b/notes/pdftract-5ec94.md @@ -0,0 +1,51 @@ +# pdftract-5ec94: Hover tooltips, JSON-tree click navigation, search filter UI + +## Summary + +All three required features were already implemented in the frontend code: + +### 1. Hover tooltips (50 ms requirement) +- **Implementation:** `setupTooltips()` in `app.js` (lines 594-671) +- **CSS:** `transition:opacity 0s` in `style.css` line 45 - instant appearance, no delay +- **Content displayed:** Text, Font (name + size), Confidence, BBox, Block ref, MCID, Reading idx +- **Data source:** `data-*` attributes populated server-side in SVG rendering + +### 2. JSON-tree click navigation +- **Span click handler:** `handleSpanClick()` (lines 344-371) +- **Setup:** `setupJsonNavigation()` (lines 335-342) +- **Behavior:** + - Clicking a span scrolls the JSON panel to the matching entry + - Adds `.highlighted` class (yellow background) for 2 seconds + - Opens parent `
` elements to reveal the entry + - Smooth scroll animation + +### 3. Search filter UI +- **Setup:** `setupSearch()` (lines 469-482) +- **Filtering:** `performSearch()` (lines 484-518) - case-insensitive substring match +- **Cycling:** `cycleMatch()` (lines 520-537) - Enter cycles forward, Shift+Enter cycles backward +- **Clearing:** `clearSearch()` (lines 556-561) - Escape key clears filter +- **Visual feedback:** + - `.search-match` class adds bright orange outline (2px solid #ff9800) + - Active match gets double outline (3px solid #ff6f00) + - Match count displayed (e.g., "3 of 7 matches") + +## Acceptance Criteria + +| Criterion | Status | Notes | +|-----------|--------|-------| +| Hover tooltip appears within 50 ms | ✅ PASS | CSS `transition:opacity 0s` - instant | +| Click span -> JSON tree scrolls + highlights | ✅ PASS | `handleSpanClick()` with smooth scroll + 2s highlight | +| Search filter narrows visible spans | ✅ PASS | `.search-match` class with bright outline | +| Enter cycles through matches | ✅ PASS | `cycleMatch(1)` on Enter, `cycleMatch(-1)` on Shift+Enter | +| Escape clears search | ✅ PASS | Keyboard handler + `clearSearch()` | +| Tooltip content matches plan | ✅ PASS | Text, Font, Confidence, Bbox, Block, MCID, Reading idx | + +## Files Verified + +- `crates/pdftract-cli/src/inspect/frontend/index.html` - HTML structure with tooltip div, search input, match count span +- `crates/pdftract-cli/src/inspect/frontend/app.js` - All JS handlers for hover, click, search +- `crates/pdftract-cli/src/inspect/frontend/style.css` - CSS for tooltip (0s transition), search-match outline, highlighted animation + +## Conclusion + +Bead requirements were already satisfied by existing code. No new implementation needed. diff --git a/tests/fixtures/PROVENANCE.md b/tests/fixtures/PROVENANCE.md index 46d20a8..5cc0e33 100644 --- a/tests/fixtures/PROVENANCE.md +++ b/tests/fixtures/PROVENANCE.md @@ -43,3 +43,7 @@ Generated: 2026-05-28 Copied from valid-minimal.pdf for SDK examples default path Minimal valid PDF v1.4 fixture for contract method examples Generated: 2026-05-31 + +# json_schema/simple_invoice.pdf +Simple invoice PDF for JSON schema validation tests +Generated: 2026-06-01 diff --git a/tests/fixtures/profiles/PROVENANCE.md b/tests/fixtures/profiles/PROVENANCE.md index f736f22..9990285 100644 --- a/tests/fixtures/profiles/PROVENANCE.md +++ b/tests/fixtures/profiles/PROVENANCE.md @@ -281,3 +281,4 @@ bash scripts/check-provenance.sh | remote_100page.pdf | tests/fixtures/generate_large_remote_fixture.rs | MIT-0 | 2026-05-29 | 16bcbee828006e51a125e7fe8e53be11ccd504b6b7e572f8ab26ee2c5c0b36e7 | Synthetic 100-page PDF for remote source range-request testing | | sample.pdf | tests/fixtures/valid-minimal.pdf (copied) | MIT-0 | 2026-05-31 | 34dabcd045665fff5dc2b2e2930905c23226704b4bc318f0ec08344be889e447 | Minimal valid PDF v1.4 fixture for SDK example default path | | security/sensitive.pdf | tests/fixtures/security/generate_sensitive_fixture.py | MIT-0 | 2026-05-29 | ba3ca8228cf835a6bc334acd8e084b32489af1a300d38b461f9db2382cbd48c6 | Synthetic password-protected PDF with unique markers for TH-08 log audit testing | +| json_schema/simple_invoice.pdf | Synthetic invoice for JSON schema validation tests | MIT-0 | 2026-06-01 | f4d642e5e31d78486a06067d18b67947f5ffd0d1ea83dcf27902b872e7a7741a | Simple invoice PDF for JSON schema validation tests |