Skip to content

/annotator improvements and page selector component#423

Merged
cubap merged 10 commits intomainfrom
339-change-pages-in-annotator
Feb 4, 2026
Merged

/annotator improvements and page selector component#423
cubap merged 10 commits intomainfrom
339-change-pages-in-annotator

Conversation

@thehabes
Copy link
Copy Markdown
Member

@thehabes thehabes commented Feb 3, 2026

Summary

Adds a reusable tpen-page-selector web component that allows users to navigate between manuscript pages in the /annotator interface. The tpen-page-selector component can be used directly by HTML interfaces or within other components. We are putting it in the tpen-line-parser component as opposed to directly on line-parser.html so that it can be easily positioned among other components being used the same way ('Go To Project Management', 'Auto Parse', etc.)

Closes #339
Closes #413
Closes #420

Changes

New Component: tpen-page-selector

  • Dropdown selector for navigating between pages in a project
  • Follows established component patterns (CleanupRegistry, onProjectReady, CheckPermissions)
  • Uses Shadow DOM with part="select" for interface-specific styling
  • Self-removes when user lacks PAGE ANY view access or project has only one page
  • Deduplicates pages across multiple layers
  • Sanitizes page labels to prevent XSS via #escapeHtml() method
  • Dispatches tpen-page-selected event for future SPA-style navigation

Integration with Line Parser

  • Imports and renders <tpen-page-selector> in the annotator interface
  • Styled to match existing UI buttons (positioned top-right below Auto Parse)
  • Includes focus-visible styles for keyboard accessibility
  • Truncates long page labels with text-overflow: ellipsis
  • Null-safe rendering (handles case where selector removes itself)

Bug Fixes

  • CONTRIBUTOR permissions (Change for CONTRIBUTOR permissions on annotator #426): Changed permission check from checkAllAccess() to checkEditAccess() && checkCreateAccess(), allowing CONTRIBUTOR role users to access the annotator interface
  • Button consistency (Action Buttons Text Oddity in /annotator #420): Changed action buttons from mixed <input type="button"> and <a> elements to consistent <button type="button"> elements for uniform font rendering
  • beforeunload handler: Fixed to use correct modern browser API (ev.preventDefault() + ev.returnValue = '') instead of non-functional confirm() pattern

Documentation

  • Added tpen-page-selected event to common events list in CLAUDE.md

@thehabes thehabes self-assigned this Feb 3, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Feb 3, 2026

@thehabes
Copy link
Copy Markdown
Member Author

thehabes commented Feb 3, 2026

💡 Future Enhancement Suggestion: SPA-style Navigation

The page selector currently triggers a full page reload on navigation via location.href. For a smoother user experience in the future, consider implementing SPA-style navigation:

  1. The tpen-page-selected event is already being dispatched with { pageId, pageIndex, page }
  2. The line-parser component could listen for this event and:
    • Update the URL via history.pushState() instead of location.href
    • Fetch new page data dynamically
    • Re-render the annotations without a full page reload

This would require architectural changes to support dynamic page loading in the line-parser component, but would significantly improve the UX for users navigating between pages frequently.


This is a suggestion for future improvement, not a blocker for this PR.

This is also the behavior of the page turner in /transcribe. #428 has been generated to note this improvement idea.

This comment was marked as resolved.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread components/page-selector/index.js
@thehabes thehabes marked this pull request as ready for review February 3, 2026 19:33
@thehabes thehabes requested a review from cubap February 3, 2026 19:33
@thehabes thehabes changed the title Change Pages in /annotator /annotator improvements and page selector component Feb 3, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@cubap cubap merged commit 8c19ca0 into main Feb 4, 2026
8 checks passed
@cubap cubap deleted the 339-change-pages-in-annotator branch February 4, 2026 17:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Action Buttons Text Oddity in /annotator CONTRIBUTOR Users Cannot Access /annotator Change Pages in the Annotator Interface

3 participants