diff options
author | Rohit Sharma <rohit2sharma95@gmail.com> | 2021-02-03 22:51:19 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-03 22:51:19 +0300 |
commit | 3770b7b9e3fd92b164a58caef05a4d9cd650a86a (patch) | |
tree | e77ca96026e5957f68939b95709731ddb4d22c5f /site | |
parent | 02d103be9155514824f74edf17db92ed407b92f3 (diff) |
Dropdown — Emit events on the `.dropdown-toggle` button (#32625)
* Emit events on the dropdown button
Emit the events on `.dropdown-toggle` button and then bubble up
* Add migration note for events
* Update the docs for events
* Add unit test to check the event bubbling
Co-authored-by: XhmikosR <xhmikosr@gmail.com>
Diffstat (limited to 'site')
-rw-r--r-- | site/content/docs/5.0/components/dropdowns.md | 3 | ||||
-rw-r--r-- | site/content/docs/5.0/migration.md | 1 |
2 files changed, 2 insertions, 2 deletions
diff --git a/site/content/docs/5.0/components/dropdowns.md b/site/content/docs/5.0/components/dropdowns.md index 9782175837..4c80e863c0 100644 --- a/site/content/docs/5.0/components/dropdowns.md +++ b/site/content/docs/5.0/components/dropdowns.md @@ -968,8 +968,7 @@ Note when `boundary` is set to any value other than `'scrollParent'`, the style ### Events -All dropdown events are fired at the `.dropdown-menu`'s parent element and have a `relatedTarget` property, whose value is the toggling anchor element. -`hide.bs.dropdown` and `hidden.bs.dropdown` events have a `clickEvent` property (only when the original Event type is `click`) that contains an Event Object for the click event. +All dropdown events are fired at the toggling element and then bubbled up. So you can also add event listeners on the `.dropdown-menu`'s parent element. `hide.bs.dropdown` and `hidden.bs.dropdown` events have a `clickEvent` property (only when the original Event type is `click`) that contains an Event Object for the click event. <table class="table"> <thead> diff --git a/site/content/docs/5.0/migration.md b/site/content/docs/5.0/migration.md index 850e27ab61..8f71fc218e 100644 --- a/site/content/docs/5.0/migration.md +++ b/site/content/docs/5.0/migration.md @@ -22,6 +22,7 @@ toc: true - Restored `offset` option for Dropdown, Popover and Tooltip plugins. - The default value for the `fallbackPlacements` is changed to `['top', 'right', 'bottom', 'left']` for better placement of popper elements. +- All the events for the dropdown are now triggered on the dropdown toggle button and then bubbled up to the parent element. ## v5.0.0-beta1 |