Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flag for the ScrollSpy component that ensures the last active element remains visible #500

Open
3 tasks done
IvanPostu opened this issue Aug 31, 2024 · 2 comments · May be fixed by #504
Open
3 tasks done

Flag for the ScrollSpy component that ensures the last active element remains visible #500

IvanPostu opened this issue Aug 31, 2024 · 2 comments · May be fixed by #504
Assignees
Labels
enhancement New feature or request

Comments

@IvanPostu
Copy link
Member

IvanPostu commented Aug 31, 2024

Before submitting...

Context

If the user scrolls the page outside of the scrollspy elements, there will be no active element in the section table-of-contents. In most cases, this is fine. However, if it's necessary to keep the last active element visible in the section table-of-contents, the component doesn't provide a way to do so.

Current Behavior

Let's imagine a blog web page with 2 sections:

  • main section
    • introduction
    • body
    • summary
  • comments

Main section is wrapped in scrollspy component.
When the user scrolls down from the main section through comments, there will be no active element in section table-of-contents.

Expected behavior

To introduce a flag keepLastActiveElementVisible (or any other name, TBD) that allows keeping the element visible inside section table-of-contents if scrollbar is outside the scrollspy elements.

Possible Solutions or Causes

To introduce that flag, if the proposal is approved then I can implement it!

Your Environment

  • Version used:
  • Browser Name and version:
  • Operating System and version (desktop or mobile):
  • Additional information you want to tell us:
@IvanPostu IvanPostu added the enhancement New feature or request label Aug 31, 2024
@IvanPostu
Copy link
Member Author

IvanPostu commented Aug 31, 2024

cc @OlivierMadant @wuda-io

I know how to implement this. If you agree with the idea, I will start working on it.

@wuda-io
Copy link
Member

wuda-io commented Sep 2, 2024

Thats a good idea! What is with the starting element? Maybe we should also add keepFirstElementActive too. From my side this is ok 👍

IvanPostu added a commit to IvanPostu/materialize that referenced this issue Sep 8, 2024
IvanPostu added a commit to IvanPostu/materialize that referenced this issue Sep 8, 2024
IvanPostu added a commit to IvanPostu/materialize that referenced this issue Sep 8, 2024
IvanPostu added a commit to IvanPostu/materialize that referenced this issue Sep 8, 2024
IvanPostu added a commit to IvanPostu/materialize that referenced this issue Sep 11, 2024
IvanPostu added a commit to IvanPostu/materialize that referenced this issue Sep 12, 2024
@IvanPostu IvanPostu self-assigned this Sep 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
2 participants