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

Add scroll-markers feature #2654

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

flackr
Copy link

@flackr flackr commented Feb 14, 2025

No description provided.

@github-actions github-actions bot added the feature definition Creating or defining new features or groups of features. label Feb 14, 2025
@@ -0,0 +1,4 @@
name: Scroll markers
description: The `::scroll-marker` CSS pseudo-element is a focusable control within its ancestor scroll container's `::scroll-marker-group` that scrolls to its originating element.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm having trouble understanding this. Would you mind giving me a practical example of how this might work/what this would look like? This would help me understand, and potentially propose a slight rewrite of this.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you have chrome canary with experimental web platform features enabled, there are some great demos at:

As an example, the following creates a set of circular "markers" to scroll to each of the slides in a slideshow:

<style>
  .slides {
    overflow: auto;
    scroll-snap-type: x mandatory;
    white-space: nowrap;
    scroll-marker-group: after;
    counter-reset: slide-number;
  }
  .slide::scroll-marker {
    counter-increment: slide-number;
    content: counter(slide-number);
    border-radius: 50%;
    border: 1px solid black;
  }
}
</style>
<div class=slides>
  <div class=slide></div>
  <div class=slide></div>
  <div class=slide></div>
  <div class=slide></div>
  <div class=slide></div>
<div class=slideshow>

Here's a somewhat simple codepen trying to show the same: https://codepen.io/flackr/pen/MWMLPpP

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature definition Creating or defining new features or groups of features.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants