Skip to content

Conversation

@cloudmark
Copy link
Contributor

BROS-199: Enhanced Paragraph Selection with "Select All" Functionality

Reason for Change

This PR implements an enhanced paragraph selection feature that allows users to efficiently select and annotate multiple phrases in paragraph-based annotation tasks. The implementation includes:

  • One-click phrase selection: Click on any phrase to select it and automatically apply selected labels
  • Proactive text selection handling: Preserves user text selections for more precise annotation
  • Enhanced keyboard shortcuts: Added hotkeys for improved annotation workflow
  • Improved visual feedback: Better styling and highlighting for selected phrases
  • Robust reaction management: Proper cleanup of MobX reactions to prevent memory leaks

Key Features

  1. Smart Phrase Selection: Clicking on a phrase automatically selects it and applies any currently selected labels
  2. Text Selection Preservation: User text selections are proactively saved and used for more precise annotations
  3. Automatic Region Management: Unselects regions that don't belong to the current phrase context
  4. Keyboard Shortcuts: Added configurable hotkeys for faster annotation workflows
  5. Feature Flag Controlled: All functionality is gated behind the FF_NER_SELECT_ALL feature flag

Technical Changes

Frontend Changes

  • HtxParagraphs.jsx: Major enhancements (+307 lines) including phrase selection logic, text selection preservation, and improved event handling
  • Phrases.jsx: Updated phrase rendering with enhanced selection capabilities (+123 lines)
  • model.js: Added MobX reactions for label selection changes, with proper cleanup mechanisms (+40 lines)
  • Paragraphs.module.scss: Enhanced styling for better visual feedback (+109 lines)

Configuration Updates

  • keymap.json: Added new keyboard shortcuts for annotation workflows
  • defaults.js: Updated hotkey configurations for account settings
  • feature-flags.ts: Added FF_NER_SELECT_ALL feature flag definition

Testing

  • Phrases.test.tsx: Comprehensive test coverage (+373 lines) for all new functionality
  • AtParagraphs.js: Added E2E test fragments for automated testing

Rollout Strategy

  • Feature Flag: All functionality is controlled by the FF_NER_SELECT_ALL feature flag
  • Gradual Rollout: Feature can be enabled for specific users/organizations initially
  • Backward Compatibility: All existing functionality remains unchanged when feature flag is disabled

Testing

Unit Tests: All new functionality covered with comprehensive test suite
E2E Tests: Updated automation fragments for end-to-end testing
Manual Testing: Verified functionality across different annotation scenarios
Performance Testing: MobX reaction cleanup prevents memory leaks
Regression Testing: Existing paragraph functionality remains unaffected

Screenshots

Loom Video Reference : https://www.loom.com/share/87a82eb4a4c7469fa53440c50eaec681

Reviewer Notes

  • Feature Flag Usage: All new functionality is properly gated behind FF_NER_SELECT_ALL

General Notes

This implementation significantly improves the annotation experience for paragraph-based tasks, particularly for NER (Named Entity Recognition) workflows. The proactive text selection handling and automatic phrase annotation features reduce the number of clicks required for efficient labeling while maintaining precision and user control.

The feature is designed to be non-intrusive and can be safely rolled out gradually through the feature flag system.

@netlify
Copy link

netlify bot commented Jul 24, 2025

Deploy Preview for label-studio-docs-new-theme canceled.

Name Link
🔨 Latest commit 96d0825
🔍 Latest deploy log https://app.netlify.com/projects/label-studio-docs-new-theme/deploys/688db1df95cdea000892823b

@netlify
Copy link

netlify bot commented Jul 24, 2025

Deploy Preview for label-studio-playground ready!

Name Link
🔨 Latest commit 96d0825
🔍 Latest deploy log https://app.netlify.com/projects/label-studio-playground/deploys/688db1df4256a8000824c366
😎 Deploy Preview https://deploy-preview-8037--label-studio-playground.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify
Copy link

netlify bot commented Jul 24, 2025

Deploy Preview for heartex-docs canceled.

Name Link
🔨 Latest commit 96d0825
🔍 Latest deploy log https://app.netlify.com/projects/heartex-docs/deploys/688db1df31e7970008bc1505

@github-actions github-actions bot added the feat label Jul 24, 2025
@netlify
Copy link

netlify bot commented Jul 24, 2025

Deploy Preview for label-studio-storybook ready!

Name Link
🔨 Latest commit 96d0825
🔍 Latest deploy log https://app.netlify.com/projects/label-studio-storybook/deploys/688db1df83344d0008e3a7a8
😎 Deploy Preview https://deploy-preview-8037--label-studio-storybook.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@codecov
Copy link

codecov bot commented Jul 24, 2025

Codecov Report

❌ Patch coverage is 88.98072% with 40 lines in your changes missing coverage. Please review.
✅ Project coverage is 66.16%. Comparing base (3d12717) to head (96d0825).
⚠️ Report is 1 commits behind head on develop.

Files with missing lines Patch % Lines
...ditor/src/tags/object/Paragraphs/HtxParagraphs.jsx 86.11% 35 Missing ⚠️
...eb/libs/editor/src/tags/object/Paragraphs/model.js 92.10% 3 Missing ⚠️
...libs/editor/src/tags/object/Paragraphs/Phrases.jsx 96.77% 0 Missing and 2 partials ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #8037      +/-   ##
===========================================
- Coverage    70.36%   66.16%   -4.21%     
===========================================
  Files          719      505     -214     
  Lines        51064    33833   -17231     
  Branches      8640     8729      +89     
===========================================
- Hits         35929    22384   -13545     
+ Misses       15132    11446    -3686     
  Partials         3        3              
Flag Coverage Δ
lsf-e2e 59.75% <68.97%> (+0.27%) ⬆️
lsf-integration 55.41% <36.84%> (-0.25%) ⬇️
lsf-unit 9.52% <21.72%> (+0.07%) ⬆️
pytests ?

Flags with carried forward coverage won't be shown. Click here to find out more.

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

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@asynclizard asynclizard force-pushed the fb-bros-199-select-all-variant branch 2 times, most recently from 908bf12 to 44d2634 Compare July 28, 2025 20:25
@niklub
Copy link
Collaborator

niklub commented Jul 28, 2025

/git merge

Workflow run
Successfully merged: create mode 100644 web/libs/ui/src/assets/icons/cloud-provider-s3.svg

@asynclizard asynclizard force-pushed the fb-bros-199-select-all-variant branch from 9c77da8 to 1081ea6 Compare July 28, 2025 21:04
- Move business logic for phrase navigation (next/previous) and "select all and annotate" from HtxParagraphs view to Paragraphs model as new model actions:
    - goToNextPhrase
    - goToPreviousPhrase
    - selectAllAndAnnotateCurrentPhrase
- Update view to call new model methods, simplifying UI code and improving separation of concerns
- Remove over-defensive type checks for playingId and method existence; use direct calls and Math.max for index safety
- Remove redundant region/label unselection helpers in favor of built-in annotation methods
- Ensure all navigation and annotation features are test-verified and work in both audio and no-audio scenarios

This refactor improves maintainability, testability, and code clarity by centralizing business logic in the model and keeping the view focused on UI.
@asynclizard asynclizard force-pushed the fb-bros-199-select-all-variant branch from 1081ea6 to e96b536 Compare July 28, 2025 21:43
@niklub
Copy link
Collaborator

niklub commented Jul 29, 2025

/git merge

Workflow run
Successfully merged: create mode 100644 web/libs/ui/src/assets/icons/cloud-provider-s3.svg

@asynclizard asynclizard force-pushed the fb-bros-199-select-all-variant branch from 2acc7fe to 5f2d956 Compare July 29, 2025 09:26
@hlomzik
Copy link
Collaborator

hlomzik commented Jul 29, 2025

/git merge

Workflow run
Successfully merged: Already up to date.

asynclizard and others added 4 commits July 30, 2025 13:30
- Add audio duration fallback for phrases without explicit end times
- Fix hotkey navigation focus for testing
- Remove redundant CSS padding logic
- Fix "Show region labels" setting refresh issue
- Fix "jump" glitch
@niklub
Copy link
Collaborator

niklub commented Aug 1, 2025

/git merge

Workflow run
Successfully merged: delete mode 100644 web/libs/editor/src/components/Timeline/Controls/VideoConfigControl.scss

@niklub
Copy link
Collaborator

niklub commented Aug 2, 2025

/git merge

Workflow run
Successfully merged: 18 files changed, 207 insertions(+), 81 deletions(-)

@niklub niklub enabled auto-merge (squash) August 2, 2025 08:48
@niklub niklub self-requested a review August 2, 2025 08:48
@niklub niklub merged commit 4e5e32a into develop Aug 2, 2025
45 of 46 checks passed
@robot-ci-heartex robot-ci-heartex deleted the fb-bros-199-select-all-variant branch August 2, 2025 08:48
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.

6 participants