Make highlighted entities clickable in visualization - #490
Conversation
Clicking a highlighted entity in the HTML visualization now selects it, updating the attributes panel, slider, and position info, which makes reviewing extractions on longer documents much faster than stepping through them sequentially. Adds a pointer cursor on highlights to signal clickability. Fixes google#103
|
Your branch is 1 commits behind git fetch origin main
git merge origin/main
git pushNote: Enable "Allow edits by maintainers" to allow automatic updates. |
|
Your branch is 1 commits behind git fetch origin main
git merge origin/main
git pushNote: Enable "Allow edits by maintainers" to allow automatic updates. |
|
Your branch is 1 commits behind git fetch origin main
git merge origin/main
git pushNote: Enable "Allow edits by maintainers" to allow automatic updates. |
1 similar comment
|
Your branch is 1 commits behind git fetch origin main
git merge origin/main
git pushNote: Enable "Allow edits by maintainers" to allow automatic updates. |
Description
Clicking a highlighted entity in the HTML visualization now jumps the selector to that extraction — updating the attributes panel, progress slider, entity counter, and position info. This makes reviewing extractions on longer documents much faster than stepping through them one at a time with Previous/Next.
Implements the suggestion from the linked issue:
cursor: pointerto.lx-highlightso highlights signal they are clickable..lx-highlightspan (viaclosest(), so nested spans work) and calls the existingjumpToExtraction().Fixes #103
Feature
How Has This Been Tested?
Added
test_visualize_highlights_are_clickabletotests/visualization_test.pyverifying the generated HTML wires up the click handler and pointer cursor.Also exercised the generated HTML in a DOM environment (jsdom): clicking a highlight selects that entity (attributes panel, slider, entity counter, and position info all update, and the
lx-current-highlightmarker moves), clicking the first entity (data-idx="0") works, and clicks on non-highlighted text are a no-op. Play/Previous/Next behavior is unchanged.Checklist:
Code of conduct.
Contributing
page, and I either signed the Google
Individual CLA
or am covered by my company's
Corporate CLA.
issue(s) and we have agreed upon the general approach.
issue(s) that documentation elsewhere needs updating.
Google's Python Style Guide
and ran
pylintover the affected code.