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 DropdownMenu dismissal #288

Merged
merged 1 commit into from Dec 20, 2019
Merged

Fix DropdownMenu dismissal #288

merged 1 commit into from Dec 20, 2019

Conversation

tcbegley
Copy link
Collaborator

@tcbegley tcbegley commented Dec 1, 2019

Previously DropdownMenuItems that were being used as internal links did not correctly dismiss the dropdown menu. This is because the internal links call preventDefault on the click event to stop the page from refreshing. However this would stop the event from reaching the underlying reactstrap component which would handle the dismissal.

This fix checks if the DropdownMenuItem is being used as an internal link, and if so takes care of dismissing the DropdownMenu itself.

To give users even more control, DropdownMenuItem now has a new prop toggle (True by default), which determines whether clicking on the item dismisses the menu.

This addresses #287

@tcbegley
Copy link
Collaborator Author

tcbegley commented Dec 1, 2019

This can be tested out with

pip install dash-bootstrap-components==0.7.3rc1

Previously DropdownMenuItems that were being used as internal links did
not correctly dismiss the dropdown menu. This is because the internal
links call preventDefault on the click event to stop the page from
refreshing. However this would stop the event from reaching the
underlying reactstrap component which would handle the dismissal.

This fix checks if the DropdownMenuItem is being used as an internal
link, and if so takes care of dismissing the DropdownMenu itself.

To give users even more control, DropdownMenuItem now has a new prop
toggle, True by default, which determines whether clicking on the item
dismisses the menu.
@tcbegley tcbegley merged commit fdf01ff into master Dec 20, 2019
2 checks passed
@tcbegley tcbegley deleted the dropdownmenu-dismiss branch Dec 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant