New focus changing causing issues for infinite paging

Created on 25 April 2024, 8 months ago
Updated 27 April 2024, 8 months ago

Problem/Motivation

🐛 When more content is loaded, move focus to first new result Fixed introduced a change that means that when the ajax command for views show more is invoked, the focus is changed to the first new item on the page.

I'm using views show more, plus some custom code that uses an intersection observer to spot when the 'show more' button is about to scroll into the viewport, and it clicks it on behalf of the user.

This works to make a really nice infinite scrolling page, with a really nice fallback, in that the show more button is there etc.

However, in 2.0.2 what happens is:

  1. Page loads
  2. User scrolls down a little
  3. Custom code clicks the show more button
  4. Views show more goes and gets more content
  5. Views show more now jumps the focus down to content that it's just brought in
  6. The next show more button is now near enough to the bottom of the viewport that my custom code clicks the button
  7. This repeats all by itself until all the content has loaded, and the visitors focus is being changed all the time

Steps to reproduce

See above

Proposed resolution

I wonder if we can detect that the button has focus, when the ajax was invoked, and if it does, do the new focus stuff, otherwise not.

Or maybe you decide that I'm crazy and you don't want to support this use-case :)

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Active

Version

2.0

Component

Code

Created by

🇬🇧United Kingdom steven jones

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024