diff options
| author | Adam Mathes <adam@adammathes.com> | 2026-02-16 19:17:59 -0800 |
|---|---|---|
| committer | Adam Mathes <adam@adammathes.com> | 2026-02-16 19:17:59 -0800 |
| commit | b500776f035779f9b9ee23ab889afa93ca987212 (patch) | |
| tree | 43b7edc592a4742969c5972c506fbc0f3feff438 /frontend/src/components | |
| parent | e8a4f637dfa10510b350b95efaa4b5eb9a8f6f28 (diff) | |
| download | neko-b500776f035779f9b9ee23ab889afa93ca987212.tar.gz neko-b500776f035779f9b9ee23ab889afa93ca987212.tar.bz2 neko-b500776f035779f9b9ee23ab889afa93ca987212.zip | |
Update V2/V3 'mark as read' logic to require item bottom to be above viewport, while keeping V1 unchanged
Diffstat (limited to 'frontend/src/components')
| -rw-r--r-- | frontend/src/components/FeedItems.test.tsx | 6 | ||||
| -rw-r--r-- | frontend/src/components/FeedItems.tsx | 4 |
2 files changed, 6 insertions, 4 deletions
diff --git a/frontend/src/components/FeedItems.test.tsx b/frontend/src/components/FeedItems.test.tsx index ad8bf4f..a1ec761 100644 --- a/frontend/src/components/FeedItems.test.tsx +++ b/frontend/src/components/FeedItems.test.tsx @@ -96,7 +96,9 @@ describe('FeedItems Component', () => { }); // Press 'j' to select first item - fireEvent.keyDown(window, { key: 'j' }); + await act(async () => { + fireEvent.keyDown(window, { key: 'j' }); + }); // Item 1 (index 0) should be selected. await waitFor(() => { @@ -150,7 +152,7 @@ describe('FeedItems Component', () => { if (this.id && this.id.startsWith('item-')) { // Item top is -50 (above container top 0) return { - top: -50, bottom: 50, height: 100, left: 0, right: 1000, width: 1000, x: 0, y: 0, + top: -150, bottom: -50, height: 100, left: 0, right: 1000, width: 1000, x: 0, y: 0, toJSON: () => { } } as DOMRect; } diff --git a/frontend/src/components/FeedItems.tsx b/frontend/src/components/FeedItems.tsx index e2df011..e38850a 100644 --- a/frontend/src/components/FeedItems.tsx +++ b/frontend/src/components/FeedItems.tsx @@ -216,8 +216,8 @@ export default function FeedItems() { const rect = el.getBoundingClientRect(); - // Mark as read if the top of the item is above the top of the container - if (rect.top < containerRect.top) { + // Mark as read if the bottom of the item is above the top of the container + if (rect.bottom < containerRect.top) { markAsRead(item); } }); |
