diff --git a/packages/volto/src/components/manage/Widgets/SchemaWidget.jsx b/packages/volto/src/components/manage/Widgets/SchemaWidget.jsx index 2a63d24f2c..696abb7769 100644 --- a/packages/volto/src/components/manage/Widgets/SchemaWidget.jsx +++ b/packages/volto/src/components/manage/Widgets/SchemaWidget.jsx @@ -1738,6 +1738,7 @@ class SchemaWidget extends Component { }, filterChoices: filterFactory, additionalChoices: additionalFactory, + sort: true, }, }, )} diff --git a/packages/volto/src/components/manage/Widgets/SelectWidget.jsx b/packages/volto/src/components/manage/Widgets/SelectWidget.jsx index ae1c0dec43..a345baa57c 100644 --- a/packages/volto/src/components/manage/Widgets/SelectWidget.jsx +++ b/packages/volto/src/components/manage/Widgets/SelectWidget.jsx @@ -7,7 +7,7 @@ import React, { Component } from 'react'; import PropTypes from 'prop-types'; import { connect } from 'react-redux'; import { compose } from 'redux'; -import { filter, map } from 'lodash'; +import { filter, map, sortBy } from 'lodash'; import { defineMessages, injectIntl } from 'react-intl'; import { getVocabFromHint, @@ -122,6 +122,7 @@ class SelectWidget extends Component { customOptionStyling: PropTypes.any, isMulti: PropTypes.bool, placeholder: PropTypes.string, + sort: PropTypes.bool, }; /** @@ -149,6 +150,7 @@ class SelectWidget extends Component { onDelete: null, noValueOption: true, customOptionStyling: null, + sort: false, }; /** @@ -240,6 +242,10 @@ class SelectWidget extends Component { options = filter(options, (item) => filterChoices.includes(item.value)); } + if (this.props.sort) { + options = sortBy(options, ['label']); + } + const normalizedValue = normalizeValue(options, value, intl); const isMulti = this.props.isMulti