diff --git a/CHANGELOG.md b/CHANGELOG.md index f44ad0da5..570570621 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -44,6 +44,7 @@ _Breaking developer changes, which may affect downstream projects or sites that #### :white_check_mark: Validation #### :bug: Bugfixes * Fix `multi/many/semiCombo` options for not being selectable immediately after removing them for fields with predefined options +* Fix a bug where the _Add_ input element on comboboxes with a fixed set of allowed options is still hidden after an option of a previously "fully saturated" field is removed #### :earth_asia: Localization * Send `Accept-Language` header on Nominatim API calls ([#9501], thanks [@k-yle]) * Add Address and Phone Format for India ([#9482], thanks [@biswajit-k]) diff --git a/modules/ui/fields/combo.js b/modules/ui/fields/combo.js index 5fa4b1540..d4374bd93 100644 --- a/modules/ui/fields/combo.js +++ b/modules/ui/fields/combo.js @@ -325,6 +325,12 @@ export function uiFieldCombo(field, context) { _container.selectAll('input') .attr('placeholder', ph); + + // Hide 'Add' button if this field uses fixed set of + // options and they're all currently used + var hideAdd = (!_allowCustomValues && !values.length); + _container.selectAll('.chiplist .input-wrap') + .style('display', hideAdd ? 'none' : null); } @@ -610,20 +616,13 @@ export function uiFieldCombo(field, context) { // a negative maxlength doesn't make sense maxLength = Math.max(0, maxLength); - var allowDragAndDrop = _isSemi // only semiCombo values are ordered - && !Array.isArray(tags[field.key]); - - // Exclude existing multikeys from combo options.. - var available = objectDifference(_comboData, _multiData); - _combobox.data(available); - - // Hide 'Add' button if this field uses fixed set of - // options and they're all currently used, - // or if the field is already at its character limit - var hideAdd = (!_allowCustomValues && !available.length) || maxLength <= 0; + // Hide 'Add' button if this field is already at its character limit + var hideAdd = maxLength <= 0; _container.selectAll('.chiplist .input-wrap') .style('display', hideAdd ? 'none' : null); + var allowDragAndDrop = _isSemi // only semiCombo values are ordered + && !Array.isArray(tags[field.key]); // Render chips var chips = _container.selectAll('.chip')