about summary refs log tree commit diff
path: root/app/javascript
diff options
context:
space:
mode:
authorYamagishi Kazutoshi <ykzts@desire.sh>2017-12-06 20:18:10 +0900
committerEugen Rochko <eugen@zeonfederated.com>2017-12-06 12:18:10 +0100
commita9ca5ce920ba3a793ab966912002b4609e29e76b (patch)
treecc4a561de3a0053fbddf9b17674bc01c7b64b3b0 /app/javascript
parentd7a17b5e8b53cd9cebe500460d2ff19d5268ef96 (diff)
Handle submit event of new list form (#5895)
Diffstat (limited to 'app/javascript')
-rw-r--r--app/javascript/mastodon/features/lists/components/new_list_form.js12
-rw-r--r--app/javascript/styles/mastodon/components.scss4
2 files changed, 9 insertions, 7 deletions
diff --git a/app/javascript/mastodon/features/lists/components/new_list_form.js b/app/javascript/mastodon/features/lists/components/new_list_form.js
index 0054e5264..eed6efc25 100644
--- a/app/javascript/mastodon/features/lists/components/new_list_form.js
+++ b/app/javascript/mastodon/features/lists/components/new_list_form.js
@@ -36,10 +36,9 @@ export default class NewListForm extends React.PureComponent {
     this.props.onChange(e.target.value);
   }
 
-  handleKeyUp = e => {
-    if (e.keyCode === 13) {
-      this.props.onSubmit();
-    }
+  handleSubmit = e => {
+    e.preventDefault();
+    this.props.onSubmit();
   }
 
   handleClick = () => {
@@ -53,7 +52,7 @@ export default class NewListForm extends React.PureComponent {
     const title = intl.formatMessage(messages.title);
 
     return (
-      <div className='column-inline-form'>
+      <form className='column-inline-form' onSubmit={this.handleSubmit}>
         <label>
           <span style={{ display: 'none' }}>{label}</span>
 
@@ -62,7 +61,6 @@ export default class NewListForm extends React.PureComponent {
             value={value}
             disabled={disabled}
             onChange={this.handleChange}
-            onKeyUp={this.handleKeyUp}
             placeholder={label}
           />
         </label>
@@ -73,7 +71,7 @@ export default class NewListForm extends React.PureComponent {
           title={title}
           onClick={this.handleClick}
         />
-      </div>
+      </form>
     );
   }
 
diff --git a/app/javascript/styles/mastodon/components.scss b/app/javascript/styles/mastodon/components.scss
index 5eeefae4d..a582d2628 100644
--- a/app/javascript/styles/mastodon/components.scss
+++ b/app/javascript/styles/mastodon/components.scss
@@ -4467,6 +4467,10 @@ noscript {
     input {
       width: 100%;
       margin-bottom: 6px;
+
+      &:focus {
+        outline: 0;
+      }
     }
   }