From 07cfad8cd841272fc8a625d1cfe76967a486d0d4 Mon Sep 17 00:00:00 2001 From: Vladimir Borisov Date: Tue, 5 Nov 2019 16:13:25 +0200 Subject: [PATCH] Multiselect autofocus first selected item --- src/common/Multiselect/Multiselect.js | 16 ++++++++++------ src/common/Popup/Popup.js | 2 +- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/common/Multiselect/Multiselect.js b/src/common/Multiselect/Multiselect.js index 7a251849b..f5b81f751 100644 --- a/src/common/Multiselect/Multiselect.js +++ b/src/common/Multiselect/Multiselect.js @@ -98,12 +98,16 @@ const Multiselect = ({ className, direction, title, renderLabelContent, renderLa
{ options.length > 0 ? - options.map(({ label, value }) => ( - - )) + options.map(({ label, value }) => { + const isSelected = selected.includes(value); + const title = typeof label === 'string' ? label : value; + return ( + + ) + }) :
No options available
diff --git a/src/common/Popup/Popup.js b/src/common/Popup/Popup.js index dc5c9bc16..5b957392d 100644 --- a/src/common/Popup/Popup.js +++ b/src/common/Popup/Popup.js @@ -68,7 +68,7 @@ const Popup = ({ open, direction, renderLabel, renderMenu, onCloseRequest, ...pr ref: labelRef, className: styles['label-container'], children: open ? - + {renderMenu()} :