Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions modules/infinite-scroll/infinity.js
Original file line number Diff line number Diff line change
Expand Up @@ -486,12 +486,16 @@

// If 'click' type and there are still posts to fetch, add back the handle
if ( type == 'click' ) {
// add focus to new posts, only in button mode as we know where page focus currently is
document
.querySelector( '#infinite-view-' + ( self.page + self.offset - 1 ) + ' a:first-of-type' )
.focus( {
preventScroll: true,
} );
// add focus to new posts, only in button mode as we know where page focus currently is and only if we have a wrapper
if ( infiniteScroll.settings.wrapper ) {
document
.querySelector(
'#infinite-view-' + ( self.page + self.offset - 1 ) + ' a:first-of-type'
)
.focus( {
preventScroll: true,
} );
}

if ( response.lastbatch ) {
if ( self.click_handle ) {
Expand Down