-
Notifications
You must be signed in to change notification settings - Fork 22.5k
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
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
- `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}} |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Absolutely!
- `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 |
There was a problem hiding this comment.
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 🐶
- `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 |
Preview URLs (comment last updated: 2024-11-11 22:28:44) |
Description
Updated the documentation for the
block
parameter inscrollIntoView()
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 existingbehavior
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 ofblock
, especially in cases where precise element positioning is needed.Additional details
For reference, see MDN scrollIntoView page.
Related issues and pull requests
Fixes #36679