mirror of
				https://github.com/vector-im/element-web.git
				synced 2025-10-30 07:41:17 +01:00 
			
		
		
		
	Merge pull request #3509 from matrix-org/bwindels/createroomenter
Fix: submit create room dialog when pressing enter
This commit is contained in:
		
						commit
						14bbaae585
					
				| @ -73,6 +73,14 @@ export default createReactClass({ | |||||||
|         this._detailsRef.removeEventListener("toggle", this.onDetailsToggled); |         this._detailsRef.removeEventListener("toggle", this.onDetailsToggled); | ||||||
|     }, |     }, | ||||||
| 
 | 
 | ||||||
|  |     _onKeyDown: function(event) { | ||||||
|  |         if (event.key === "Enter") { | ||||||
|  |             this.onOk(); | ||||||
|  |             event.preventDefault(); | ||||||
|  |             event.stopPropagation(); | ||||||
|  |         } | ||||||
|  |     }, | ||||||
|  | 
 | ||||||
|     onOk: async function() { |     onOk: async function() { | ||||||
|         const activeElement = document.activeElement; |         const activeElement = document.activeElement; | ||||||
|         if (activeElement) { |         if (activeElement) { | ||||||
| @ -176,7 +184,7 @@ export default createReactClass({ | |||||||
|             <BaseDialog className="mx_CreateRoomDialog" onFinished={this.props.onFinished} |             <BaseDialog className="mx_CreateRoomDialog" onFinished={this.props.onFinished} | ||||||
|                 title={title} |                 title={title} | ||||||
|             > |             > | ||||||
|                 <form onSubmit={this.onOk}> |                 <form onSubmit={this.onOk} onKeyDown={this._onKeyDown}> | ||||||
|                     <div className="mx_Dialog_content"> |                     <div className="mx_Dialog_content"> | ||||||
|                         <Field id="name" ref={ref => this._nameFieldRef = ref} label={ _t('Name') } onChange={this.onNameChange} onValidate={this.onNameValidate} value={this.state.name} className="mx_CreateRoomDialog_name" /> |                         <Field id="name" ref={ref => this._nameFieldRef = ref} label={ _t('Name') } onChange={this.onNameChange} onValidate={this.onNameValidate} value={this.state.name} className="mx_CreateRoomDialog_name" /> | ||||||
|                         <Field id="topic" label={ _t('Topic (optional)') } onChange={this.onTopicChange} value={this.state.topic} /> |                         <Field id="topic" label={ _t('Topic (optional)') } onChange={this.onTopicChange} value={this.state.topic} /> | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user