Repository navigation
Conversation
In mobile view, the sort order was only applied during initial paint or when explicitly chosen from the sort dialog. On subsequent polling cycles from the engine, changes in upload/download speeds, completion percentage, or other sort metrics did not reorder existing DOM rows, leaving the list in a stale order until an explicit sort or reload occurred. Reevaluate the DOM row order in processTorrents after receiving updated torrent data. When row placement differs from the active sort order, reorder existing rows via reorderRows using moveBefore and appendChild to preserve DOM element identity and focus. Animate the reordering so torrents visually flow up or down into their new positions using the View Transitions API (document-level and scoped transitions) with unique per-row view-transition-names. Provide a FLIP (First, Last, Invert, Play) transform fallback for browsers without View Transitions support. Skip animations when prefers-reduced-motion is active or for lists exceeding 200 items. Normalize numeric sort comparison in dynamicSort to avoid string-ordering and falsy-zero comparison bugs, with deterministic secondary (name) and tertiary (hash) tie-breaking. Announce sort changes to assistive technology through a visually hidden role="status" live region. Includes unit test coverage for dynamicSort, live DOM reordering, View Transitions, FLIP fallbacks, and motion preferences. Assisted-by: AI (Google DeepMind / Antigravity)
Implement Option A: graceful, minimal visual feedback for dynamically reordered torrents in the mobile interface. - Replace table-row View Transitions and transform-based FLIP with a subtle accent-color inset pulse animation (rank-highlight). - Apply .rank-highlight to table cells when a torrent changes rank in active view during background poll cycles; automatically cleans up after 1.5 seconds. - Respect prefers-reduced-motion via declarative media query. - Maintain DOM stability without shifting touch targets mid-tap. - Update mobile sort unit tests to verify rank tracking and pulse lifecycle.
Preserve Bootstrap's underlying table striping layer in the rank-change and added-torrent highlight box-shadows. Previously, @Keyframes rank-highlight and added-highlight set a single inset box-shadow, overwriting Bootstrap's table-striped shadow during the animation and causing odd rows to fade into the plain background before abruptly snapping back to the striped color when the highlight class was removed. Layering the accent highlight on top of the table's active/type background state allows the highlight to fade smoothly into the correct alternating background color for every line with zero post-fade color jump.
xirvik
self-requested a review
November 22, 2026 22:35
xirvik
requested changes
Nov 22, 2026
xirvik
left a comment
Collaborator
There was a problem hiding this comment.
This one needs some polishing
- The whole list flashes. A row counts as "moved" when its position number changes, so one torrent jumping to the top flashes all 300 rows.
- Cost per update: on desktop at 300 rows with 10% of torrents changing, about 7 ms on master against 53–88 ms on the PR. At 2000 rows, 99 ms against 405 ms. Phones will be slower.
- Rows move under your finger while you're scrolled into the list, so a tap can hit the wrong torrent.
- Some tests can't fail, and name sorting quietly changes from numeric-aware ("2 x" before "10 x") to plain text order.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
In mobile view, when sorting by attributes such as upload speed (
-ul), download speed (-dl), size, ratio, or seeding time, the order was only evaluated once during initial list creation. Subsequent periodic poll updates (plugin.processTorrents) updated row speeds, metrics, and progress bars in-place without re-sorting the DOM table rows. As a result, when a torrent's speed or status changed significantly, its position in the list remained static.This PR reevaluates the user-specified sort order on every polling cycle, updates the DOM order when ranks shift, and provides subtle, non-intrusive visual feedback.
Changes
Dynamic sort reevaluation on poll updates:
plugin.processTorrents: Reevaluates sort order againsttorrentArrayon every poll cycle.tbodyDOM ordering with the new sort order. When order changes,plugin.reorderRowsreorders the table rows using modernElement.prototype.moveBefore(when available) orappendChild.ul,dl,size,ratio,eta, etc.) withparseFloat/Numberto prevent string-comparison ordering bugs.name-> tertiary byhash) so rows do not fluctuate when speeds match.Graceful rank-change visual feedback:
.rank-highlight) is applied to shifted rows for 1.5 seconds.var(--bs-table-bg-state, var(--bs-table-bg-type, var(--bs-table-accent-bg))), ensuring the highlight fades smoothly into each line's alternating background color with zero post-fade color jump.rowsPrimed = false) so startup remains clean.prefers-reduced-motion: reducevia declarative CSS media query.Accessibility:
aria-liveannouncement region (<div id="sortLiveStatus" role="status" class="visually-hidden">) inmobile.htmland updatedplugin.setSortto announce sort field and direction changes to screen readers.Tests:
tests/plugins/mobile/sort.spec.jscovering numeric sort ordering, deterministic tie-breaking, DOM reordering on speed changes, rank-shift tracking, initial render suppression, andmoveBeforeDOM reordering.Testing
Note: This pull request was prepared with AI assistance.