Skip to content

Commit f28d100

Browse files
authored
Merge pull request #382 from puppetlabs/development
2 parents 0b1b379 + 38f79e8 commit f28d100

File tree

5 files changed

+15
-4
lines changed

5 files changed

+15
-4
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# react-components 5.26.4 (2021-02-10)
2+
3+
- [Select] Fix autocomplete select not staying open when typing (by [@jilliankeenan](https://github.com/jilliankeenan) in [#381](https://github.com/puppetlabs/design-system/pull/381))
4+
15
# react-components 5.26.3 (2021-01-29)
26

37
- [Icon] Add inventory icon (by [@mardotio](https://github.com/mardotio) in [#379](https://github.com/puppetlabs/design-system/pull/379))

packages/react-components/package-lock.json

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/react-components/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@puppet/react-components",
3-
"version": "5.26.3",
3+
"version": "5.26.4",
44
"author": "Puppet, Inc.",
55
"license": "Apache-2.0",
66
"main": "build/library.js",

packages/react-components/source/react/internal/option-menu-list/OptionMenuList.js

+7-1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import Icon from '../../library/icon';
2020
const propTypes = {
2121
id: PropTypes.string.isRequired,
2222
multiple: PropTypes.bool,
23+
autocomplete: PropTypes.bool,
2324
showCancel: PropTypes.bool,
2425
options: PropTypes.arrayOf(
2526
PropTypes.shape({
@@ -49,6 +50,7 @@ const propTypes = {
4950
const defaultProps = {
5051
options: [],
5152
multiple: false,
53+
autocomplete: false,
5254
showCancel: false,
5355
onBlur() {},
5456
className: '',
@@ -261,7 +263,7 @@ class OptionMenuList extends Component {
261263
}
262264

263265
select(value) {
264-
const { multiple, selected, onChange } = this.props;
266+
const { multiple, selected, onChange, autocomplete, onEscape } = this.props;
265267

266268
if (multiple) {
267269
const selectionSet = getSelectionSet(selected);
@@ -274,6 +276,9 @@ class OptionMenuList extends Component {
274276
onChange(Array.from(selectionSet));
275277
} else {
276278
onChange(value);
279+
if (autocomplete) {
280+
onEscape();
281+
}
277282
}
278283
}
279284

@@ -306,6 +311,7 @@ class OptionMenuList extends Component {
306311
options,
307312
selected,
308313
multiple,
314+
autocomplete,
309315
showCancel,
310316
actionLabel,
311317
cancelLabel,

packages/react-components/source/react/library/select/Select.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ class Select extends Component {
192192
this.setState({ focusedIndex: 0 });
193193
}
194194

195-
if (type !== MULTISELECT) {
195+
if (type !== MULTISELECT && type !== AUTOCOMPLETE) {
196196
this.closeAndFocusButton();
197197
}
198198
}
@@ -455,6 +455,7 @@ class Select extends Component {
455455
<OptionMenuList
456456
id={`${name}-menu`}
457457
multiple={type === MULTISELECT}
458+
autocomplete={type === AUTOCOMPLETE}
458459
showCancel={type === MULTISELECT && !applyImmediately}
459460
options={getOptions()}
460461
selected={listValue}

0 commit comments

Comments
 (0)