From f53ff4e5c4b0c2d54c7f74d677fb08519e499561 Mon Sep 17 00:00:00 2001 From: Sami Mazouz Date: Fri, 10 Nov 2023 11:45:46 +0100 Subject: [PATCH] fix(a11y): convert empty links to buttons --- extensions/tags/js/src/forum/addTagComposer.js | 8 ++++++-- extensions/tags/less/forum.less | 1 + .../src/forum/components/DiscussionListItem.tsx | 12 +++++++++--- .../core/js/src/forum/components/LogInModal.tsx | 10 ++++++++-- .../core/js/src/forum/components/PostMeta.js | 5 +++-- .../js/src/forum/components/PostStreamScrubber.js | 13 +++++++------ .../core/js/src/forum/components/SignUpModal.tsx | 6 +++++- framework/core/less/common/Button.less | 7 ++++++- framework/core/less/common/mixins.less | 1 + framework/core/less/common/mixins/typography.less | 9 +++++++++ framework/core/less/common/scaffolding.less | 8 +------- framework/core/less/forum/Post.less | 2 +- framework/core/less/forum/Scrubber.less | 15 +++------------ 13 files changed, 60 insertions(+), 37 deletions(-) create mode 100644 framework/core/less/common/mixins/typography.less diff --git a/extensions/tags/js/src/forum/addTagComposer.js b/extensions/tags/js/src/forum/addTagComposer.js index 7cffe7ce16..2af418e0b5 100644 --- a/extensions/tags/js/src/forum/addTagComposer.js +++ b/extensions/tags/js/src/forum/addTagComposer.js @@ -5,6 +5,7 @@ import classList from 'flarum/common/utils/classList'; import tagsLabel from '../common/helpers/tagsLabel'; import getSelectableTags from './utils/getSelectableTags'; +import Button from '@flarum/core/src/common/components/Button'; export default function addTagComposer() { extend(IndexSidebar.prototype, 'newDiscussionAction', function (promise) { @@ -47,13 +48,16 @@ export default function addTagComposer() { items.add( 'tags', - + , 10 ); }); diff --git a/extensions/tags/less/forum.less b/extensions/tags/less/forum.less index bca726db6b..15798ee4b5 100644 --- a/extensions/tags/less/forum.less +++ b/extensions/tags/less/forum.less @@ -32,6 +32,7 @@ } .DiscussionComposer-changeTags { margin-right: 15px; + line-height: inherit; &.disabled { opacity: 0.5; diff --git a/framework/core/js/src/forum/components/DiscussionListItem.tsx b/framework/core/js/src/forum/components/DiscussionListItem.tsx index fd5decba8e..6dd785b9aa 100644 --- a/framework/core/js/src/forum/components/DiscussionListItem.tsx +++ b/framework/core/js/src/forum/components/DiscussionListItem.tsx @@ -148,9 +148,15 @@ export default class DiscussionListItem - - - + {user ? ( + + + + ) : ( + + + + )} , 100 ); diff --git a/framework/core/js/src/forum/components/LogInModal.tsx b/framework/core/js/src/forum/components/LogInModal.tsx index c087e64310..f9b12182a8 100644 --- a/framework/core/js/src/forum/components/LogInModal.tsx +++ b/framework/core/js/src/forum/components/LogInModal.tsx @@ -122,10 +122,16 @@ export default class LogInModal

- {app.translator.trans('core.forum.log_in.forgot_password_link')} +

{app.forum.attribute('allowSignUp') && ( -

{app.translator.trans('core.forum.log_in.sign_up_text', { a: })}

+

+ {app.translator.trans('core.forum.log_in.sign_up_text', { + a:

{app.translator.trans('core.forum.post.number_tooltip', { number: post.number() })}{' '} diff --git a/framework/core/js/src/forum/components/PostStreamScrubber.js b/framework/core/js/src/forum/components/PostStreamScrubber.js index 6880bc9abc..a169497864 100644 --- a/framework/core/js/src/forum/components/PostStreamScrubber.js +++ b/framework/core/js/src/forum/components/PostStreamScrubber.js @@ -3,6 +3,7 @@ import Component from '../../common/Component'; import formatNumber from '../../common/utils/formatNumber'; import ScrollListener from '../../common/utils/ScrollListener'; import Icon from '../../common/components/Icon'; +import Button from '../../common/components/Button'; /** * The `PostStreamScrubber` component displays a scrubber which can be used to @@ -63,9 +64,9 @@ export default class PostStreamScrubber extends Component {
- - {app.translator.trans('core.forum.post_scrubber.original_post_link')} - +
@@ -83,9 +84,9 @@ export default class PostStreamScrubber extends Component {
- - {app.translator.trans('core.forum.post_scrubber.now_link')} - +
diff --git a/framework/core/js/src/forum/components/SignUpModal.tsx b/framework/core/js/src/forum/components/SignUpModal.tsx index c456cbb7f4..ad74e5929d 100644 --- a/framework/core/js/src/forum/components/SignUpModal.tsx +++ b/framework/core/js/src/forum/components/SignUpModal.tsx @@ -137,7 +137,11 @@ export default class SignUpModal{app.translator.trans('core.forum.sign_up.log_in_text', { a: })}

, +

+ {app.translator.trans('core.forum.sign_up.log_in_text', { + a: