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

Fix modal being displayed when dropdown toggle is clicked #41083

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

alhernandez25
Copy link

Description

When a dropdown toggle is embedded in a div that is also a toggle for a modal, both the modal and the dropdown are triggered. This may be intentional, but if not, this fix would temporarily disable the modal toggle.

Motivation & Context

When using Bootstrap for my own project, I had a div with data-bs-toggle=modal and inside this div I also placed a dropdown toggle. My expectation was if I clicked on the dropdown toggle, it would take precedence over the modal toggle and open the dropdown and not the modal

Type of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Refactoring (non-breaking change)
  • Breaking change (fix or feature that would change existing functionality)

Checklist

  • I have read the contributing guidelines
  • My code follows the code style of the project (using npm run lint)
  • My change introduces changes to the documentation
  • I have updated the documentation accordingly
  • I have added tests to cover my changes
  • All new and existing tests passed

Live previews

Related issues

When a dropdown toggle is embedded in a div that is also a toggle for a modal, both the modal and the dropdown are triggered. This may be intentional, but if not, this fix would temporarily disable the modal toggle.
@alhernandez25 alhernandez25 requested a review from a team as a code owner December 7, 2024 08:24
Copy link
Member

@julien-deramond julien-deramond left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for submitting a PR @alhernandez25

My first feedback is that the dropdown component should remain autonomous and should not import the modal in its source code. I haven't checked the context of the fix, but we should find a more generic way to do that if possible.

Moreover, all JavaScript modifications in the codebase should have corresponding unit tests.

Could you please also try to create a StackBlitz or CodePen with the issue you encountered? It would help understanding the issue more rapidly on our side 🙏

@alhernandez25
Copy link
Author

Thank you for submitting a PR @alhernandez25

My first feedback is that the dropdown component should remain autonomous and should not import the modal in its source code. I haven't checked the context of the fix, but we should find a more generic way to do that if possible.

Moreover, all JavaScript modifications in the codebase should have corresponding unit tests.

Could you please also try to create a StackBlitz or CodePen with the issue you encountered? It would help understanding the issue more rapidly on our side 🙏

Will do! Thank you

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

Successfully merging this pull request may close these issues.

2 participants