Skip to content

Fix DropdownMenu dismissal#288

Merged
tcbegley merged 1 commit intomasterfrom
dropdownmenu-dismiss
Dec 20, 2019
Merged

Fix DropdownMenu dismissal#288
tcbegley merged 1 commit intomasterfrom
dropdownmenu-dismiss

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 tcbegley force-pushed the dropdownmenu-dismiss branch from 07d0fa5 to 8e83fd8 Compare December 1, 2019 10:29
@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 force-pushed the dropdownmenu-dismiss branch from 8e83fd8 to 1de90b7 Compare December 20, 2019 11:03
@tcbegley tcbegley merged commit fdf01ff into master Dec 20, 2019
@tcbegley tcbegley deleted the dropdownmenu-dismiss branch December 20, 2019 11:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant