From 0165449e3a062238511489a8b23f3facd98258b6 Mon Sep 17 00:00:00 2001
From: Sunny Ripert <sunny@sunfox.org>
Date: Fri, 4 Nov 2022 17:08:08 +0100
Subject: [PATCH] A11y: Explicit <form> element around compose area (#19742)

---
 app/javascript/mastodon/components/button.js         |  2 ++
 .../features/compose/components/compose_form.js      | 12 +++++++++---
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/app/javascript/mastodon/components/button.js b/app/javascript/mastodon/components/button.js
index 85b2d78ca..bcb855c7c 100644
--- a/app/javascript/mastodon/components/button.js
+++ b/app/javascript/mastodon/components/button.js
@@ -6,6 +6,7 @@ export default class Button extends React.PureComponent {
 
   static propTypes = {
     text: PropTypes.node,
+    type: PropTypes.string,
     onClick: PropTypes.func,
     disabled: PropTypes.bool,
     block: PropTypes.bool,
@@ -42,6 +43,7 @@ export default class Button extends React.PureComponent {
         onClick={this.handleClick}
         ref={this.setRef}
         title={this.props.title}
+        type={this.props.type}
       >
         {this.props.text || this.props.children}
       </button>
diff --git a/app/javascript/mastodon/features/compose/components/compose_form.js b/app/javascript/mastodon/features/compose/components/compose_form.js
index cd10d0eda..9f5c3b314 100644
--- a/app/javascript/mastodon/features/compose/components/compose_form.js
+++ b/app/javascript/mastodon/features/compose/components/compose_form.js
@@ -217,7 +217,7 @@ class ComposeForm extends ImmutablePureComponent {
     }
 
     return (
-      <div className='compose-form'>
+      <form className='compose-form'>
         <WarningContainer />
 
         <ReplyIndicatorContainer />
@@ -279,10 +279,16 @@ class ComposeForm extends ImmutablePureComponent {
 
         <div className='compose-form__publish'>
           <div className='compose-form__publish-button-wrapper'>
-            <Button text={publishText} onClick={this.handleSubmit} disabled={!this.canSubmit()} block />
+            <Button
+              type="submit"
+              text={publishText}
+              onClick={this.handleSubmit}
+              disabled={!this.canSubmit()}
+              block
+            />
           </div>
         </div>
-      </div>
+      </form>
     );
   }