-
-
Notifications
You must be signed in to change notification settings - Fork 78.9k
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
touch device (e.g. iOS) dropdown backdrop is removed incorrectly #16516
Comments
I think the backdrop should be removed in clearMenus after the function clearMenus(e) {
if (e && e.which === 3) return
$(toggle).each(function () {
...
$parent.trigger(e = $.Event('hide.bs.dropdown', relatedTarget))
if (e.isDefaultPrevented()) return
$parent.find(backdrop).remove()
$this.attr('aria-expanded', 'false')
$parent.removeClass('open').trigger('hidden.bs.dropdown', relatedTarget)
})
} |
|
@cvrebert does twbs have a preference which workaround is implemented? |
|
I encountered this issue with the How to reproduce
Results
Possible cause Temporary workaround $(document).on('show.bs.dropdown', function(event) {
$('.dropdown-backdrop').off().remove();
}); I am aware that this way we do not follow the best practices of having a dropdown-menu close "when clicking elsewhere on a page", but this is better than a crashing browser tab. In this case the assertions in the system log still fail, but a lot less and the tab does not freeze anymore.
Suggestions for a more elegant approach are welcome. Just reporting this to make this issue better findable and hopefully some day have Bootstrap itself incorporate a way to improve stability on iOS devices. |
Just wondering whether this issue is on the radar for version 4? |
@holtkamp Your problem is fairly different from this issue. Please open a new issue. |
Bootstrap 3 is no longer being officially developed or supported. All work has moved onto our next major release, v4. As such, this issue or pull request is being closed as a "won't fix." For additional help and support, we recommend utilizing our community resources. Thanks for your understanding, and see you on the other side of v4! <3, |
This issue can be seen in this fiddle (http://jsfiddle.net/rfyt2fr3/1/) on an iOS touch device (probably other touch devices as well):
On touch devices, the bootstrap plugin adds a dropdown:
https://github.com/twbs/bootstrap/blob/master/js/dropdown.js#L69
It's evident that this backdrop is meant to compensate for the known issue of click events not
propagatingdelegating, otherwise theclearMenus
doesn't run when you click anywhere:https://github.com/twbs/bootstrap/blob/master/js/dropdown.js#L158
The code that removes the backdrop does so, even if the
hide.bs.dropdown
event handler prevented the close.https://github.com/twbs/bootstrap/blob/master/js/dropdown.js#L37
The text was updated successfully, but these errors were encountered: