What is the reason for the special treatment of fixed-*
and sticky-*
elements when the scrollbar disappears during modal.show
?
#41131
Unanswered
tesar-tech
asked this question in
Q&A
Replies: 1 comment 1 reply
-
The special treatment for fixed and sticky elements is to maintain their intended positioning during modal display. When the scrollbar is removed, it can affect how these elements behave, especially if they rely on the viewport height. Adjusting their positioning helps Bootstrap prevent any unexpected shifts or alignment issues. It’s more about preserving the user experience across different layouts. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
When using a modal, the scrollbar is removed from the body, and padding is added to compensate for the scrollbar width, ensuring the layout remains consistent. This functionality is handled by Bootstrap's
scrollbar.js
.However, there is also special treatment for elements with
sticky
orfixed
classes. I’m trying to understand why this is necessary, as everything seems properly aligned with just the padding on the body.I can’t identify a layout scenario where this special treatment would be required to prevent alignment issues.
Thank you.
Beta Was this translation helpful? Give feedback.
All reactions