diff --git a/.eslintrc.yml b/.eslintrc.yml index 2c264351ec..fd2ba46dd0 100644 --- a/.eslintrc.yml +++ b/.eslintrc.yml @@ -121,6 +121,6 @@ rules: jsx-a11y/onclick-has-focus: warn jsx-a11y/onclick-has-role: warn jsx-a11y/role-has-required-aria-props: warn - jsx-a11y/role-supports-aria-props: warn + jsx-a11y/role-supports-aria-props: off jsx-a11y/scope: warn jsx-a11y/tabindex-no-positive: warn diff --git a/app/javascript/mastodon/components/dropdown_menu.js b/app/javascript/mastodon/components/dropdown_menu.js index 8e9e6ab94a..f62a75183a 100644 --- a/app/javascript/mastodon/components/dropdown_menu.js +++ b/app/javascript/mastodon/components/dropdown_menu.js @@ -74,6 +74,18 @@ export default class DropdownMenu extends React.PureComponent { handleHide = () => this.setState({ expanded: false }) + handleToggle = (e) => { + if (e.key === 'Enter') { + if (this.props.isUserTouching()) { + this.handleShow(); + } else { + this.setState({ expanded: !this.state.expanded }); + } + } else if (e.key === 'Escape') { + this.setState({ expanded: false }); + } + } + renderItem = (item, i) => { if (item === null) { return
; @@ -83,7 +95,7 @@ export default class DropdownMenu extends React.PureComponent { return (