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

[css-scroll-snap-2] Should scroll-start-target specify alignment? #9012

Open
DavMila opened this issue Jun 27, 2023 · 3 comments
Open

[css-scroll-snap-2] Should scroll-start-target specify alignment? #9012

DavMila opened this issue Jun 27, 2023 · 3 comments

Comments

@DavMila
Copy link
Contributor

DavMila commented Jun 27, 2023

The scroll-snap-2 spec lets authors specify "none" or "auto" for scroll-start-target.
Would it be more useful to allow authors to specify how scrollers should align to these targets?

Perhaps keyword options similar to scrollintoview or scroll-snap-align would make sense.

@DavMila DavMila changed the title [css-scroll-snap-2] Should scroll-start-target specify alignment [css-scroll-snap-2] Should scroll-start-target specify alignment? Jun 27, 2023
@flackr
Copy link
Contributor

flackr commented Oct 5, 2023

I think we should consider a more generic mechanism for all operations which attempt to scroll a particular fragment into view. E.g. similar to how scroll-behavior sets the default behavior (smooth or instant, see example) and can be overridden by the scrollintoview behavior.

When there is a specified scroll-snap-align value we should be using that alignment, as best case we will scroll to that alignment anyways, but worst case scroll snap may move away from the scrolled to element due to another snap point being closer to the scroll position.

So putting all of this together, I think this might be something like,
scroll-align: [normal | snap]? [ start | end | center ]{1,2}

Where this specifies the alignment to be used for scrolling operations targeting the element (scroll-start, anchor navigation, etc).

And then specifying a non-none value for scroll-snap-align could set the scroll align type to snap?

@DavMila
Copy link
Contributor Author

DavMila commented Oct 10, 2023

I think a generic mechanism sounds like a good idea. And having scroll-snap-align set scroll-align makes sense.

Could you elaborate a little on the proposal for scroll-align's syntax: why is the first option needed given that scroll-snap-align will override scroll-align? Or are there cases where it would/should not override?

chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this issue Oct 10, 2023
There is a proposal[1] for a more generic element-level scroll  alignment indicator which would apply to scroll-start-targets and would mean that scroll-snap-align dictates the alignment of
scroll-start-targets.
It is likely that that work will be realized later than
scroll-start-target.
This patch allows scroll-snap-align directly specify the alignment of
scroll-start-targets; this behavior is closer to the end-goal of that proposal.

[1]w3c/csswg-drafts#9012 (comment)

Bug: 1439807
Change-Id: Id6ff1937a806d00c3ac0326d53d379d1c39b5897
@flackr
Copy link
Contributor

flackr commented Oct 11, 2023

Could you elaborate a little on the proposal for scroll-align's syntax: why is the first option needed given that scroll-snap-align will override scroll-align? Or are there cases where it would/should not override?

The normal option allows you to specify an alignment for scroll targeting operations (e.g. linked to an element or scroll-start without making the element a snap point.

Technically we don't need that if we still have scroll-snap-align as a separate property but it's a bit awkward to have two properties attempting to determine the scroll-align alignment. By making scroll-align capable of handling snap alignment, scroll-snap-align becomes an alias for setting scroll-align and internally we only need to track the scroll-align value.

aarongable pushed a commit to chromium/chromium that referenced this issue Oct 25, 2023
There is a proposal[1] for a more generic element-level scroll
alignment indicator which would apply to scroll-start-targets and would
mean that scroll-snap-align dictates the alignment of
scroll-start-targets.
It is likely that that work will be realized later than
scroll-start-target.
This patch allows scroll-snap-align directly specify the alignment of
scroll-start-targets; this behavior is closer to the end-goal of that
proposal.

[1]w3c/csswg-drafts#9012 (comment)

Bug: 1439807
Change-Id: Id6ff1937a806d00c3ac0326d53d379d1c39b5897
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4906566
Commit-Queue: David Awogbemila <[email protected]>
Reviewed-by: Steve Kobes <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1214872}
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this issue Oct 25, 2023
There is a proposal[1] for a more generic element-level scroll
alignment indicator which would apply to scroll-start-targets and would
mean that scroll-snap-align dictates the alignment of
scroll-start-targets.
It is likely that that work will be realized later than
scroll-start-target.
This patch allows scroll-snap-align directly specify the alignment of
scroll-start-targets; this behavior is closer to the end-goal of that
proposal.

[1]w3c/csswg-drafts#9012 (comment)

Bug: 1439807
Change-Id: Id6ff1937a806d00c3ac0326d53d379d1c39b5897
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4906566
Commit-Queue: David Awogbemila <[email protected]>
Reviewed-by: Steve Kobes <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1214872}
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this issue Oct 25, 2023
There is a proposal[1] for a more generic element-level scroll
alignment indicator which would apply to scroll-start-targets and would
mean that scroll-snap-align dictates the alignment of
scroll-start-targets.
It is likely that that work will be realized later than
scroll-start-target.
This patch allows scroll-snap-align directly specify the alignment of
scroll-start-targets; this behavior is closer to the end-goal of that
proposal.

[1]w3c/csswg-drafts#9012 (comment)

Bug: 1439807
Change-Id: Id6ff1937a806d00c3ac0326d53d379d1c39b5897
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4906566
Commit-Queue: David Awogbemila <[email protected]>
Reviewed-by: Steve Kobes <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1214872}
moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this issue Nov 7, 2023
…d align with scroll-snap-align, a=testonly

Automatic update from web-platform-tests
[scroll-start] scroll-start-target should align with scroll-snap-align

There is a proposal[1] for a more generic element-level scroll
alignment indicator which would apply to scroll-start-targets and would
mean that scroll-snap-align dictates the alignment of
scroll-start-targets.
It is likely that that work will be realized later than
scroll-start-target.
This patch allows scroll-snap-align directly specify the alignment of
scroll-start-targets; this behavior is closer to the end-goal of that
proposal.

[1]w3c/csswg-drafts#9012 (comment)

Bug: 1439807
Change-Id: Id6ff1937a806d00c3ac0326d53d379d1c39b5897
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4906566
Commit-Queue: David Awogbemila <[email protected]>
Reviewed-by: Steve Kobes <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1214872}

--

wpt-commits: ae3d6e3e0e7121408c173e158fb9eab53ec29b88
wpt-pr: 42293
vinnydiehl pushed a commit to vinnydiehl/mozilla-unified that referenced this issue Nov 7, 2023
…d align with scroll-snap-align, a=testonly

Automatic update from web-platform-tests
[scroll-start] scroll-start-target should align with scroll-snap-align

There is a proposal[1] for a more generic element-level scroll
alignment indicator which would apply to scroll-start-targets and would
mean that scroll-snap-align dictates the alignment of
scroll-start-targets.
It is likely that that work will be realized later than
scroll-start-target.
This patch allows scroll-snap-align directly specify the alignment of
scroll-start-targets; this behavior is closer to the end-goal of that
proposal.

[1]w3c/csswg-drafts#9012 (comment)

Bug: 1439807
Change-Id: Id6ff1937a806d00c3ac0326d53d379d1c39b5897
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4906566
Commit-Queue: David Awogbemila <[email protected]>
Reviewed-by: Steve Kobes <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1214872}

--

wpt-commits: ae3d6e3e0e7121408c173e158fb9eab53ec29b88
wpt-pr: 42293
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified-and-comments-removed that referenced this issue Nov 8, 2023
…d align with scroll-snap-align, a=testonly

Automatic update from web-platform-tests
[scroll-start] scroll-start-target should align with scroll-snap-align

There is a proposal[1] for a more generic element-level scroll
alignment indicator which would apply to scroll-start-targets and would
mean that scroll-snap-align dictates the alignment of
scroll-start-targets.
It is likely that that work will be realized later than
scroll-start-target.
This patch allows scroll-snap-align directly specify the alignment of
scroll-start-targets; this behavior is closer to the end-goal of that
proposal.

[1]w3c/csswg-drafts#9012 (comment)

Bug: 1439807
Change-Id: Id6ff1937a806d00c3ac0326d53d379d1c39b5897
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4906566
Commit-Queue: David Awogbemila <awogbemilachromium.org>
Reviewed-by: Steve Kobes <skobeschromium.org>
Cr-Commit-Position: refs/heads/main{#1214872}

--

wpt-commits: ae3d6e3e0e7121408c173e158fb9eab53ec29b88
wpt-pr: 42293

UltraBlame original commit: 637542733650a3aab5435d804077aa3d7c50cafb
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified that referenced this issue Nov 8, 2023
…d align with scroll-snap-align, a=testonly

Automatic update from web-platform-tests
[scroll-start] scroll-start-target should align with scroll-snap-align

There is a proposal[1] for a more generic element-level scroll
alignment indicator which would apply to scroll-start-targets and would
mean that scroll-snap-align dictates the alignment of
scroll-start-targets.
It is likely that that work will be realized later than
scroll-start-target.
This patch allows scroll-snap-align directly specify the alignment of
scroll-start-targets; this behavior is closer to the end-goal of that
proposal.

[1]w3c/csswg-drafts#9012 (comment)

Bug: 1439807
Change-Id: Id6ff1937a806d00c3ac0326d53d379d1c39b5897
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4906566
Commit-Queue: David Awogbemila <awogbemilachromium.org>
Reviewed-by: Steve Kobes <skobeschromium.org>
Cr-Commit-Position: refs/heads/main{#1214872}

--

wpt-commits: ae3d6e3e0e7121408c173e158fb9eab53ec29b88
wpt-pr: 42293

UltraBlame original commit: 637542733650a3aab5435d804077aa3d7c50cafb
gecko-dev-updater pushed a commit to marco-c/gecko-dev-comments-removed that referenced this issue Nov 8, 2023
…d align with scroll-snap-align, a=testonly

Automatic update from web-platform-tests
[scroll-start] scroll-start-target should align with scroll-snap-align

There is a proposal[1] for a more generic element-level scroll
alignment indicator which would apply to scroll-start-targets and would
mean that scroll-snap-align dictates the alignment of
scroll-start-targets.
It is likely that that work will be realized later than
scroll-start-target.
This patch allows scroll-snap-align directly specify the alignment of
scroll-start-targets; this behavior is closer to the end-goal of that
proposal.

[1]w3c/csswg-drafts#9012 (comment)

Bug: 1439807
Change-Id: Id6ff1937a806d00c3ac0326d53d379d1c39b5897
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4906566
Commit-Queue: David Awogbemila <awogbemilachromium.org>
Reviewed-by: Steve Kobes <skobeschromium.org>
Cr-Commit-Position: refs/heads/main{#1214872}

--

wpt-commits: ae3d6e3e0e7121408c173e158fb9eab53ec29b88
wpt-pr: 42293

UltraBlame original commit: 637542733650a3aab5435d804077aa3d7c50cafb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants