diff --git a/kjvstudy_org/templates/book.html b/kjvstudy_org/templates/book.html index 8d8002b..739efe3 100644 --- a/kjvstudy_org/templates/book.html +++ b/kjvstudy_org/templates/book.html @@ -515,8 +515,15 @@ document.addEventListener('DOMContentLoaded', function() { selectParagraph(selectedParagraphIndex - 1); } } else { - // No selection, start at chapter section - selectChapterSection(); + // No selection - start with first visible item + if (chapterSection && KJVNav.isInViewport(chapterSection)) { + selectChapterSection(); + } else if (contentParagraphs.length > 0) { + const visibleIndex = KJVNav.findFirstVisibleIndex(Array.from(contentParagraphs)); + selectParagraph(visibleIndex); + } else { + selectChapterSection(); + } } } @@ -547,8 +554,15 @@ document.addEventListener('DOMContentLoaded', function() { selectParagraph(selectedParagraphIndex + 1); } } else { - // No selection, start at chapter section - selectChapterSection(); + // No selection - start with first visible item + if (chapterSection && KJVNav.isInViewport(chapterSection)) { + selectChapterSection(); + } else if (contentParagraphs.length > 0) { + const visibleIndex = KJVNav.findFirstVisibleIndex(Array.from(contentParagraphs)); + selectParagraph(visibleIndex); + } else { + selectChapterSection(); + } } }