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

docs: update scrollIntoView() block parameter description in API documentation #36727

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

FelixTakeOne
Copy link
Contributor

Description

Updated the documentation for the block parameter in scrollIntoView() to clarify its possible values (start, center, end, nearest) and their effects on vertical alignment. This change improves understanding of the parameter by providing a detailed explanation similar to the existing behavior parameter description.

Motivation

The original documentation lacked specific details on how the block parameter values affect element alignment within the scrollable ancestor. By expanding this section, we help developers better understand the use of block, especially in cases where precise element positioning is needed.

Additional details

For reference, see MDN scrollIntoView page.

Related issues and pull requests

Fixes #36679

@FelixTakeOne FelixTakeOne requested a review from a team as a code owner November 11, 2024 07:26
@FelixTakeOne FelixTakeOne requested review from wbamberg and removed request for a team November 11, 2024 07:26
@github-actions github-actions bot added Content:WebAPI Web API docs size/s [PR only] 6-50 LoC changed labels Nov 11, 2024
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@FelixTakeOne FelixTakeOne changed the title Felix take one patch 1 docs: update scrollIntoView() block parameter description in API documentation Nov 11, 2024
- `end`: Aligns the element's bottom edge with the bottom of the scrollable container, placing the element at the end of the visible area vertically.
- `nearest`: Scrolls the element to the nearest edge in the vertical direction. If the element is closer to the top edge of the scrollable container, it will align to the top; if it's closer to the bottom
edge, it will align to the bottom. This minimizes the scrolling distance.
- Defaults to `start`.
- `inline` {{optional_inline}}
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice job! I was about to submit the PR too. Since you’ve already created it, would you mind adding descriptions to the inline properties as well?

Something like the following, feel free to use your own words

- `start`: Aligns the left of the element with the left of the visible area of the scrollable ancestor.
- `center`: Aligns the center of the element with the horizontal center of the visible area of the scrollable ancestor.
- `end`: Aligns the right of the element with the right of the visible area of the scrollable ancestor.
- `nearest`: Aligns the element with the nearest horizontal edge of the visible area of the scrollable ancestor.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Absolutely!

@github-actions github-actions bot added size/xs [PR only] 0-5 LoC changed and removed size/s [PR only] 6-50 LoC changed labels Nov 11, 2024
@github-actions github-actions bot added size/s [PR only] 6-50 LoC changed and removed size/xs [PR only] 0-5 LoC changed labels Nov 11, 2024
- `start`: Aligns the element's left edge with the left of the scrollable container, making the element appear at the start of the visible area horizontally.
- `center`: Aligns the element horizontally at the center of the scrollable container, positioning it in the middle of the visible area.
- `end`: Aligns the element's right edge with the right of the scrollable container, placing the element at the end of the visible area horizontally.
- `nearest`: Scrolls the element to the nearest edge in the horizontal direction. If the element is closer to the left edge of the scrollable container, it will align to the left; if it's closer to the
Copy link
Contributor

Choose a reason for hiding this comment

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

[mdn-linter] reported by reviewdog 🐶

Suggested change
- `nearest`: Scrolls the element to the nearest edge in the horizontal direction. If the element is closer to the left edge of the scrollable container, it will align to the left; if it's closer to the
- `nearest`: Scrolls the element to the nearest edge in the horizontal direction. If the element is closer to the left edge of the scrollable container, it will align to the left; if it's closer to the

Copy link
Contributor

github-actions bot commented Nov 11, 2024

Preview URLs

(comment last updated: 2024-11-11 22:28:44)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Content:WebAPI Web API docs size/s [PR only] 6-50 LoC changed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

scrollIntoView page doesn't describe what the start, center, end, or nearest argument values do.
2 participants