Kaynağa Gözat

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

master
Leonard Kim 7 yıl önce
ebeveyn
işleme
b76ab305e3

+ 15
- 1
react/features/welcome/components/WelcomePage.web.js Dosyayı Görüntüle

55
             'welcome-page-additional-content-template');
55
             'welcome-page-additional-content-template');
56
 
56
 
57
         // Bind event handlers so they are only bound once per instance.
57
         // Bind event handlers so they are only bound once per instance.
58
+        this._onFormSubmit = this._onFormSubmit.bind(this);
58
         this._onRoomChange = this._onRoomChange.bind(this);
59
         this._onRoomChange = this._onRoomChange.bind(this);
59
         this._setAdditionalContentRef
60
         this._setAdditionalContentRef
60
             = this._setAdditionalContentRef.bind(this);
61
             = this._setAdditionalContentRef.bind(this);
121
                         <div id = 'new_enter_room'>
122
                         <div id = 'new_enter_room'>
122
                             <form
123
                             <form
123
                                 className = 'enter-room-input'
124
                                 className = 'enter-room-input'
124
-                                onSubmit = { this._onJoin }>
125
+                                onSubmit = { this._onFormSubmit }>
125
                                 <FieldTextStateless
126
                                 <FieldTextStateless
126
                                     autoFocus = { true }
127
                                     autoFocus = { true }
127
                                     id = 'enter_room_field'
128
                                     id = 'enter_room_field'
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
      * Overrides the super to account for the differences in the argument types
171
      * Overrides the super to account for the differences in the argument types
158
      * provided by HTML and React Native text inputs.
172
      * provided by HTML and React Native text inputs.

Loading…
İptal
Kaydet