1
0
mirror of https://github.com/flarum/core.git synced 2025-08-09 18:07:02 +02:00

fix: close dropdown when focusing out

This commit is contained in:
Sami Mazouz
2025-04-18 11:52:06 +01:00
parent f6edf619a9
commit bd5f5b4170

View File

@@ -123,6 +123,13 @@ export default class Dropdown<CustomAttrs extends IDropdownAttrs = IDropdownAttr
m.redraw();
});
// Focusing out of the dropdown should close it.
this.$().on('focusout', (e) => {
if (e.relatedTarget && !this.$().has(e.relatedTarget).length) {
this.$().trigger('hidden.bs.dropdown');
}
});
}
/**