Skip to content

Commit a0a77b9

Browse files
committed
make sure lngering event handlers aes cleared before setting new ones
fixes a bug where the valid options of multi/semi-combo fields were now updated properly when a previous tag change caused the preset of the feature to change. for example: `leisure=pitch` with `sport=tennis`: when clearing the `sport` tag, the feature changes preset from "Tennis Court" to "Pitch", but it keeps the field for the `sport` tag. However, if the event handlers are not reset, the old event handlers (of the Tennis Cour preset) are still set, preventing the new ones (with the updated tag of the feature) from taking effect. fixes #12217
1 parent 7e34a47 commit a0a77b9

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ _Breaking developer changes, which may affect downstream projects or sites that
6262
* Include `railway` and `building` features with lifecycle status only in _past/future_ features category ([#9058])
6363
* Disable autocomplete on changeset comment box on mobile Firefox to work around buggy/glitchy behavior of the input field ([#9011])
6464
* Fix crash when trying to delete a single-node way ([#9007])
65+
* Make sure the available options of multi/semi-combo fields are updated properly when a previous tag change caused a change of the feature's preset ([#12217])
6566
#### :earth_asia: Localization
6667
#### :hourglass: Performance
6768
#### :mortar_board: Walkthrough / Help
@@ -96,6 +97,7 @@ _Breaking developer changes, which may affect downstream projects or sites that
9697
[#12139]: https://github.com/openstreetmap/iD/pull/12139
9798
[#12169]: https://github.com/openstreetmap/iD/issues/12169
9899
[#12178]: https://github.com/openstreetmap/iD/pull/12178
100+
[#12217]: https://github.com/openstreetmap/iD/issues/12217
99101

100102

101103
# 2.39.6

modules/ui/fields/combo.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,9 @@ export function uiFieldCombo(field, context) {
262262
selection.attr('readonly', 'readonly');
263263
}
264264

265+
// clear previously existing old event handlers (e.g. when switching preset)
266+
selection.call(uiCombobox.off, context);
267+
265268
if (_showTagInfoSuggestions && services.taginfo) {
266269
selection.call(_combobox.fetcher(setTaginfoValues), attachTo);
267270
setTaginfoValues('', setPlaceholder);
@@ -703,9 +706,9 @@ export function uiFieldCombo(field, context) {
703706
.attr('type', 'text')
704707
.attr('dir', 'auto')
705708
.attr('id', field.domId)
709+
.merge(_input)
706710
.call(utilNoAuto)
707-
.call(initCombo, _container)
708-
.merge(_input);
711+
.call(initCombo, _container);
709712

710713
if (_isSemi) {
711714
_inputWrap.call(_lengthIndicator);

0 commit comments

Comments
 (0)