This repository was archived by the owner on Sep 11, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +7
-8
lines changed Expand file tree Collapse file tree 2 files changed +7
-8
lines changed Original file line number Diff line number Diff line change @@ -143,6 +143,10 @@ export default class Field extends React.PureComponent<PropShapes, IState> {
143143
144144 public focus ( ) {
145145 this . input . focus ( ) ;
146+ // programmatic does not fire onFocus handler
147+ this . setState ( {
148+ focused : true ,
149+ } ) ;
146150 }
147151
148152 private onFocus = ( ev ) => {
Original file line number Diff line number Diff line change @@ -214,7 +214,6 @@ export const SpaceCreateForm: React.FC<ISpaceCreateFormProps> = ({
214214} ;
215215
216216const SpaceCreateMenu = ( { onFinished } ) => {
217- const cli = useContext ( MatrixClientContext ) ;
218217 const [ visibility , setVisibility ] = useState < Visibility > ( null ) ;
219218 const [ busy , setBusy ] = useState < boolean > ( false ) ;
220219
@@ -238,13 +237,9 @@ const SpaceCreateMenu = ({ onFinished }) => {
238237 return ;
239238 }
240239
241- // validate the space alias field but do not require it
242- const aliasLocalpart = alias . substring ( 1 , alias . length - cli . getDomain ( ) . length - 1 ) ;
243- if ( visibility === Visibility . Public && aliasLocalpart &&
244- ( await spaceAliasField . current . validate ( { allowEmpty : true } ) ) === false
245- ) {
240+ if ( visibility === Visibility . Public && ! ( await spaceAliasField . current . validate ( { allowEmpty : false } ) ) ) {
246241 spaceAliasField . current . focus ( ) ;
247- spaceAliasField . current . validate ( { allowEmpty : true , focused : true } ) ;
242+ spaceAliasField . current . validate ( { allowEmpty : false , focused : true } ) ;
248243 setBusy ( false ) ;
249244 return ;
250245 }
@@ -253,7 +248,7 @@ const SpaceCreateMenu = ({ onFinished }) => {
253248 await createSpace (
254249 name ,
255250 visibility === Visibility . Public ,
256- aliasLocalpart ? alias : undefined ,
251+ alias ,
257252 topic ,
258253 avatar ,
259254 ) ;
You can’t perform that action at this time.
0 commit comments