docsify icon indicating copy to clipboard operation
docsify copied to clipboard

Select last sidebar sub-item on scroll reach bottom

Open GCSBOSS opened this issue 3 years ago • 0 comments

Feature request

What problem does this feature solve?

Scrolling a page all the way to the bottom does not activate the last sub-item on sidebar when the section is somewhat short.

image

What does the proposed API look like?

No API needed

How should this be implemented in your opinion?

Not sure how the code works, but there might already be a scroll hook to select the current active sub-menu. Just add in there that if it reached bottom, must select the last item.

On src/core/event/scroll.js file. highlight() function. After this:

  if (!last) {
    return;
  }

Around line 63, add:

  const maxTop = doc.scrollHeight - doc.clientHeight;
  if(top >= maxTop)
    last = anchors.pop();

Might work.

Are you willing to work on this yourself?

Possibly.

GCSBOSS avatar Jul 12 '22 11:07 GCSBOSS