Don't autocomplete tags like name_1 in raw tag editor, closes #9422

This commit is contained in:
Martin Raifer
2023-11-17 14:03:59 +01:00
parent d4bfbaaf4a
commit ac172a2b0e
2 changed files with 5 additions and 2 deletions
+2
View File
@@ -40,6 +40,7 @@ _Breaking developer changes, which may affect downstream projects or sites that
#### :tada: New Features
#### :sparkles: Usability & Accessibility
* Show the color of (route) relations in the form of small colored circles in relation membership section and feature search results ([#9424])
* Hide tag suggestions for tags like `name_1` in raw tag editor autocomplete ([#9422])
#### :scissors: Operations
#### :camera: Street-Level
#### :white_check_mark: Validation
@@ -50,6 +51,7 @@ _Breaking developer changes, which may affect downstream projects or sites that
#### :hammer: Development
[#9424]: https://github.com/openstreetmap/iD/pull/9424
[#9422]: https://github.com/openstreetmap/iD/issues/9422
# 2.27.3
+3 -2
View File
@@ -433,9 +433,10 @@ export function uiSectionRawTagEditor(id, context) {
}, function(err, data) {
if (!err) {
const filtered = data
.filter(d => _tags[d.value] === undefined)
.filter(d => _tags[d.value] === undefined) // already used tag
.filter(d => !(d.value in _discardTags)) // do not suggest discardable tags (see #9817)
.filter(d => d.value.toLowerCase().includes(value.toLowerCase()));
.filter(d => !/_\d$/.test(d)) // tag like name_1 (see #9422)
.filter(d => d.value.toLowerCase().includes(value.toLowerCase())); // tag does not match user input
callback(sort(value, filtered));
}
});