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

Modal.js: ScrollBar tweak makes some redundant actions on sticky-top #33580

Closed
GeoSot opened this issue Apr 7, 2021 · 1 comment
Closed

Modal.js: ScrollBar tweak makes some redundant actions on sticky-top #33580

GeoSot opened this issue Apr 7, 2021 · 1 comment
Labels

Comments

@GeoSot
Copy link
Member

GeoSot commented Apr 7, 2021

While a modal is opened, the code tries to make some magic with padding/margin on fixed elements

Although line 459 adds paddingRight on .sticky-top and line 460 reverts this, adding negative marginRight

this._setElementAttributes(SELECTOR_STICKY_CONTENT, 'marginRight', calculatedValue => calculatedValue - this._scrollbarWidth)

this._setElementAttributes(SELECTOR_FIXED_CONTENT, 'paddingRight', calculatedValue => calculatedValue + this._scrollbarWidth)

Replicate:

  • Go to docs/modal
  • Open the modal. The <nav class="bd-subnavbar py-2" aria-label="Secondary navigation"> is stiky by css, but it will not be affected at all while modal opens.
  • Then add the sticky-top class <nav class="bd-subnavbar py-2 sticky-top" aria-label="Secondary navigation">
  • open the browser inspector
  • open the modal again

Result:

The nav element will have two js-added properties

padding-right: 17px;
margin-right: -17px;

Example test attached:
image

Ps: The same issue, lives in scrollbar.js too, as it is a copy of modal code

@GeoSot
Copy link
Member Author

GeoSot commented Apr 9, 2021

Below we can see the two defferences

css sticky-top
image

class sticky-top
image

I do not know if this counts like bug or not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant