From fcd8a2b2e7076af2daba9d512750295abb9d2335 Mon Sep 17 00:00:00 2001 From: Martin Raifer Date: Thu, 3 Feb 2022 18:46:42 +0100 Subject: [PATCH] optimize order of values of `access` fields (closes #8945) --- CHANGELOG.md | 4 ++++ modules/ui/fields/access.js | 24 ++++++++++++++++-------- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index eedfc202f..e89395119 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -43,11 +43,15 @@ _Breaking developer changes, which may affect downstream projects or sites that #### :newspaper: News * Drop legacy support for Internet Explorer 11 ([#8811]) +#### :rocket: Presets +* Optimize order of values in dropdowns of `access` fields ([#8945]) #### :hammer: Development * Switch build system to [esbuild](https://esbuild.github.io/) for much faster builds ([#8774], thanks [@ mbrzakovic] and [@bhousel]) [#8774]: https://github.com/openstreetmap/iD/pull/8774 [#8811]: https://github.com/openstreetmap/iD/issues/8811 +[#8945]: https://github.com/openstreetmap/iD/issues/8945 + # 2.20.4 ##### 2022-Feb-03 diff --git a/modules/ui/fields/access.js b/modules/ui/fields/access.js index c17cf18e8..6cb7c0006 100644 --- a/modules/ui/fields/access.js +++ b/modules/ui/fields/access.js @@ -79,15 +79,23 @@ export function uiFieldAccess(field, context) { access.options = function(type) { - var options = ['no', 'permissive', 'private', 'permit', 'destination', 'customers', 'unknown']; + var options = [ + 'yes', + 'no', + 'designated', + 'permissive', + 'destination', + 'customers', + 'private', + 'permit', + 'unknown' + ]; - if (type !== 'access') { - options.unshift('yes'); - options.push('designated'); - - if (type === 'bicycle') { - options.push('dismount'); - } + if (type === 'access') { + options = options.filter(v => v !== 'yes' && v !== 'designated'); + } + if (type === 'bicycle') { + options.splice(options.length - 4, 0, 'dismount'); } return options.map(function(option) {