about summary refs log tree commit diff
path: root/app/javascript/mastodon/features/notifications/components/setting_toggle.js
diff options
context:
space:
mode:
Diffstat (limited to 'app/javascript/mastodon/features/notifications/components/setting_toggle.js')
-rw-r--r--app/javascript/mastodon/features/notifications/components/setting_toggle.js8
1 files changed, 7 insertions, 1 deletions
diff --git a/app/javascript/mastodon/features/notifications/components/setting_toggle.js b/app/javascript/mastodon/features/notifications/components/setting_toggle.js
index be1ff91d6..a20e7ca51 100644
--- a/app/javascript/mastodon/features/notifications/components/setting_toggle.js
+++ b/app/javascript/mastodon/features/notifications/components/setting_toggle.js
@@ -18,13 +18,19 @@ export default class SettingToggle extends React.PureComponent {
     this.props.onChange(this.props.settingKey, target.checked);
   }
 
+  onKeyDown = e => {
+    if (e.key === ' ') {
+      this.props.onChange(this.props.settingKey, !e.target.checked);
+    }
+  }
+
   render () {
     const { prefix, settings, settingKey, label, meta } = this.props;
     const id = ['setting-toggle', prefix, ...settingKey].filter(Boolean).join('-');
 
     return (
       <div className='setting-toggle'>
-        <Toggle id={id} checked={settings.getIn(settingKey)} onChange={this.onChange} />
+        <Toggle id={id} checked={settings.getIn(settingKey)} onChange={this.onChange} onKeyDown={this.onKeyDown} />
         <label htmlFor={id} className='setting-toggle__label'>{label}</label>
         {meta && <span className='setting-meta__label'>{meta}</span>}
       </div>