-
-
Notifications
You must be signed in to change notification settings - Fork 79.1k
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
Dropdown with initial "show" does not seems to correctly place the dropdown if you are using some of the positioning classes #41148
Comments
🛠️ Issue ⚡ Why It Happens 📍 What Happens if You Only Add the .show Class 🚫 Current Bootstrap Support If You're Interested in the Code That Does Not Run: show() {
if (isDisabled(this._element) || this._isShown()) {
return
}
const relatedTarget = {
relatedTarget: this._element
}
const showEvent = EventHandler.trigger(this._element, EVENT_SHOW, relatedTarget)
if (showEvent.defaultPrevented) {
return
}
this._createPopper()
// If this is a touch-enabled device we add extra
// empty mouseover listeners to the body's immediate children;
// only needed because of broken event delegation on iOS
// https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
if ('ontouchstart' in document.documentElement && !this._parent.closest(SELECTOR_NAVBAR_NAV)) {
for (const element of [].concat(...document.body.children)) {
EventHandler.on(element, 'mouseover', noop)
}
}
this._element.focus()
this._element.setAttribute('aria-expanded', true)
this._menu.classList.add(CLASS_NAME_SHOW)
this._element.classList.add(CLASS_NAME_SHOW)
EventHandler.trigger(this._element, EVENT_SHOWN, relatedTarget)
} |
Faced the same issue, adding a link to Codepen with reproducing the issue: https://codepen.io/MurzNN/pen/ogNVXMY |
Prerequisites
Describe the issue
This is related to the dropdown. If I use the class "show" on load the aligning is not working correctly with the example below.
The problem is the class "dropdown-menu-end". It does not seems to work correctly. When I close it and open it again it is it displayed correctly. Most of the code is taken from your examples.
Reduced test cases
What operating system(s) are you seeing the problem on?
Windows
What browser(s) are you seeing the problem on?
Chrome, Microsoft Edge
What version of Bootstrap are you using?
5.3.3
The text was updated successfully, but these errors were encountered: