Skip to content

Commit dc14710

Browse files
authored
feat: Keyboard Enter key can be used to select item in data browser filter dialog field dropdown (#2771)
1 parent 39263f2 commit dc14710

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

src/components/Autocomplete/Autocomplete.react.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,10 +251,17 @@ export default class Autocomplete extends Component {
251251
// Enter
252252
const { userInput } = this.state;
253253

254-
if (e.keyCode === 13) {
255-
if (userInput && userInput.length > 0) {
254+
if (e.keyCode === 13 || e.key === 'Enter') {
255+
if (userInput && userInput.length > 0 && this.props.onSubmit) {
256256
this.props.onSubmit(userInput);
257257
}
258+
259+
this.setState({
260+
active: true,
261+
activeSuggestion: 0,
262+
showSuggestions: false,
263+
userInput: filteredSuggestions[activeSuggestion] || userInput,
264+
});
258265
} else if (e.keyCode === 9) {
259266
// Tab
260267
// do not type it

src/components/SuggestionsList/SuggestionsList.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
color: #0e69a1;
3030
cursor: pointer;
3131
font-weight: 500;
32+
background: rgba(255, 255, 255, 0.1) !important;
3233
}
3334

3435
.suggestions li:not(:last-of-type) {

0 commit comments

Comments
 (0)