Merge pull request #3047 from matrix-org/bwindels/autocomplete-enter-fix
only capture enter if something was selected in completionspull/21833/head
						commit
						2f98d0edb7
					
				|  | @ -162,6 +162,10 @@ export default class Autocomplete extends React.Component { | |||
|         }); | ||||
|     } | ||||
| 
 | ||||
|     hasSelection(): bool { | ||||
|         return this.countCompletions() > 0 && this.state.selectionOffset !== 0; | ||||
|     } | ||||
| 
 | ||||
|     countCompletions(): number { | ||||
|         return this.state.completionList.length; | ||||
|     } | ||||
|  |  | |||
|  | @ -989,7 +989,7 @@ export default class MessageComposerInput extends React.Component { | |||
|             return change.insertText('\n'); | ||||
|         } | ||||
| 
 | ||||
|         if (this.autocomplete.countCompletions() > 0) { | ||||
|         if (this.autocomplete.hasSelection()) { | ||||
|             this.autocomplete.hide(); | ||||
|             ev.preventDefault(); | ||||
|             return true; | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	 Bruno Windels
						Bruno Windels