aboutsummaryrefslogtreecommitdiff
path: root/p
diff options
context:
space:
mode:
authorGravatar Inverle <inverle@proton.me> 2025-09-13 00:15:03 +0200
committerGravatar GitHub <noreply@github.com> 2025-09-13 00:15:03 +0200
commit08335911313ff98e0a791c5f773078f819519db6 (patch)
tree125a4f34ead19b0ef2974af878983042d5a1c6e5 /p
parent8a0436ede2b14080689e027bccc97822db6a01b5 (diff)
Fix JS error when navigating to last article with keyboard (#7957)
This error would print in the console if navigating to last article with <kbd>J</kbd> or <kbd>K</kbd> key: <img width="836" height="173" alt="image" src="https://github.com/user-attachments/assets/0ae88d1c-26eb-4ebe-8d15-4bf03c24cef6" /> --- To reproduce the bug: <ol> <li>Select unread + read view, while having all articles marked as read</li> <li>Mark two as unread and go to unread only view</li> <li>Navigate with either <kbd>J</kbd> or <kbd>K</kbd> until you go past the last article or before first article</li> <li>See error in console and no navigation with <code>first_feed()</code> or <code>last_feed()</code></li> </ol> note: I'm not sure if the fix is what the expected behavior is supposed to be
Diffstat (limited to 'p')
-rw-r--r--p/scripts/main.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/p/scripts/main.js b/p/scripts/main.js
index 813890e42..06d3609d5 100644
--- a/p/scripts/main.js
+++ b/p/scripts/main.js
@@ -592,7 +592,7 @@ function prev_feed() {
adjacent = feed;
}
}
- if (found) {
+ if (found && adjacent) {
delayedClick(adjacent.querySelector('a.item-title'));
} else {
last_feed();
@@ -622,7 +622,7 @@ function next_feed() {
adjacent = feed;
}
}
- if (found) {
+ if (found && adjacent) {
delayedClick(adjacent.querySelector('a.item-title'));
} else {
first_feed();