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

Commit edfebdc

Browse files
authored
Don't reload the page when user hits enter when entering ban reason (#7145)
1 parent 734ce97 commit edfebdc

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

Diff for: src/components/views/dialogs/ConfirmUserActionDialog.tsx

+5-3
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17-
import React, { ChangeEvent, ReactNode } from 'react';
17+
import React, { ChangeEvent, FormEvent, ReactNode } from 'react';
1818
import { MatrixClient } from 'matrix-js-sdk/src/client';
1919
import { RoomMember } from "matrix-js-sdk/src/models/room-member";
2020
import classNames from "classnames";
@@ -76,7 +76,8 @@ export default class ConfirmUserActionDialog extends React.Component<IProps, ISt
7676
};
7777
}
7878

79-
private onOk = (): void => {
79+
private onOk = (ev: FormEvent): void => {
80+
ev.preventDefault();
8081
this.props.onFinished(true, this.state.reason);
8182
};
8283

@@ -144,7 +145,8 @@ export default class ConfirmUserActionDialog extends React.Component<IProps, ISt
144145
{ reasonBox }
145146
{ this.props.children }
146147
</div>
147-
<DialogButtons primaryButton={this.props.action}
148+
<DialogButtons
149+
primaryButton={this.props.action}
148150
onPrimaryButtonClick={this.onOk}
149151
primaryButtonClass={confirmButtonClass}
150152
focus={!this.props.askReason}

0 commit comments

Comments
 (0)