Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

fix(welcome-page): prevent form submit to prevent page refresh

Leonard Kimb76ab305e301
diff --git a/react/features/welcome/components/WelcomePage.web.js b/react/features/welcome/components/WelcomePage.web.js
index 3feeb20bc0..c69ee90d78 100644
--- a/react/features/welcome/components/WelcomePage.web.js
+++ b/react/features/welcome/components/WelcomePage.web.js
@@ -55,6 +55,7 @@ class WelcomePage extends AbstractWelcomePage {
'welcome-page-additional-content-template');
// Bind event handlers so they are only bound once per instance.
+ this._onFormSubmit = this._onFormSubmit.bind(this);
this._onRoomChange = this._onRoomChange.bind(this);
this._setAdditionalContentRef
= this._setAdditionalContentRef.bind(this);
@@ -121,7 +122,7 @@ class WelcomePage extends AbstractWelcomePage {
<div id = 'new_enter_room'>
<form
className = 'enter-room-input'
- onSubmit = { this._onJoin }>
+ onSubmit = { this._onFormSubmit }>
<FieldTextStateless
autoFocus = { true }
id = 'enter_room_field'
@@ -153,6 +154,19 @@ class WelcomePage extends AbstractWelcomePage {
);
}
+ /**
+ * Prevents submission of the form and delagates join logic.
+ *
+ * @param {Event} event - The HTML Event which details the form submission.
+ * @private
+ * @returns {void}
+ */
+ _onFormSubmit(event) {
+ event.preventDefault();
+
+ this._onJoin();
+ }
+
/**
* Overrides the super to account for the differences in the argument types
* provided by HTML and React Native text inputs.