make sure combobox dropdown is removed when input field is removed

fixes #10319: when a relation membership role is edited, the change will trigger a redraw of the combobox (via D3 exit/enter). In this case, the `blur` event is never called, because the input element is immediately removed from the DOM. This is solved by cleaning up the dropdown when the combobox is about to be removed from the page.
This commit is contained in:
Martin Raifer
2025-02-25 13:07:58 +01:00
parent f4d4a9e3b0
commit ca7ae603c9
2 changed files with 17 additions and 11 deletions
+1
View File
@@ -67,6 +67,7 @@ _Breaking developer changes, which may affect downstream projects or sites that
* Fix too dim markers of selected/hovered photo of some street level imagery layers ([#10755], thanks [@draunger])
* Fix `+` symbol appearing in changeset comments from external tools ([#10766], thanks [@k-yle])
* Fix `destination_sign` relations from being corrupted when splitting a way ([#10646], thanks [@k-yle])
* Fix combobox dropdown menu sticking around under certain conditions (e.g. while editing the role of a relation member and deselecting a feature #10319)
#### :earth_asia: Localization
* Add `housename` to address format in Bolivia ([#10727])
#### :hourglass: Performance
+16 -11
View File
@@ -154,18 +154,8 @@ export function uiCombobox(context, klass) {
.on('scroll.combo-scroll', render, true);
}
function hide() {
if (_comboHideTimerID) {
window.clearTimeout(_comboHideTimerID);
_comboHideTimerID = undefined;
}
container.selectAll('.combobox')
.remove();
container
.on('scroll.combo-scroll', null);
_hide(container);
}
@@ -515,7 +505,22 @@ export function uiCombobox(context, klass) {
}
function _hide(container) {
if (_comboHideTimerID) {
window.clearTimeout(_comboHideTimerID);
_comboHideTimerID = undefined;
}
container.selectAll('.combobox')
.remove();
container
.on('scroll.combo-scroll', null);
}
uiCombobox.off = function(input, context) {
_hide(context.container());
input
.on('focus.combo-input', null)
.on('blur.combo-input', null)