Pārlūkot izejas kodu

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

master
Leonard Kim 7 gadus atpakaļ
vecāks
revīzija
b76ab305e3
1 mainītis faili ar 15 papildinājumiem un 1 dzēšanām
  1. 15
    1
      react/features/welcome/components/WelcomePage.web.js

+ 15
- 1
react/features/welcome/components/WelcomePage.web.js Parādīt failu

@@ -55,6 +55,7 @@ class WelcomePage extends AbstractWelcomePage {
55 55
             'welcome-page-additional-content-template');
56 56
 
57 57
         // Bind event handlers so they are only bound once per instance.
58
+        this._onFormSubmit = this._onFormSubmit.bind(this);
58 59
         this._onRoomChange = this._onRoomChange.bind(this);
59 60
         this._setAdditionalContentRef
60 61
             = this._setAdditionalContentRef.bind(this);
@@ -121,7 +122,7 @@ class WelcomePage extends AbstractWelcomePage {
121 122
                         <div id = 'new_enter_room'>
122 123
                             <form
123 124
                                 className = 'enter-room-input'
124
-                                onSubmit = { this._onJoin }>
125
+                                onSubmit = { this._onFormSubmit }>
125 126
                                 <FieldTextStateless
126 127
                                     autoFocus = { true }
127 128
                                     id = 'enter_room_field'
@@ -153,6 +154,19 @@ class WelcomePage extends AbstractWelcomePage {
153 154
         );
154 155
     }
155 156
 
157
+    /**
158
+     * Prevents submission of the form and delagates join logic.
159
+     *
160
+     * @param {Event} event - The HTML Event which details the form submission.
161
+     * @private
162
+     * @returns {void}
163
+     */
164
+    _onFormSubmit(event) {
165
+        event.preventDefault();
166
+
167
+        this._onJoin();
168
+    }
169
+
156 170
     /**
157 171
      * Overrides the super to account for the differences in the argument types
158 172
      * provided by HTML and React Native text inputs.

Notiek ielāde…
Atcelt
Saglabāt