Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit 53d7c9d

Browse files
authored
Merge pull request #6921 from matrix-org/t3chguy/fix/19003.1
2 parents 2a3c483 + ccba7ba commit 53d7c9d

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

src/components/views/elements/Field.tsx

+4
Original file line numberDiff line numberDiff 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) => {

src/components/views/spaces/SpaceCreateMenu.tsx

+3-8
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,6 @@ export const SpaceCreateForm: React.FC<ISpaceCreateFormProps> = ({
214214
};
215215

216216
const 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
);

0 commit comments

Comments
 (0)