1
0
mirror of https://github.com/flarum/core.git synced 2025-08-06 16:36:47 +02:00

fix(a11y): convert empty links to buttons (#3926)

This commit is contained in:
Sami Mazouz
2024-09-19 22:35:20 +01:00
committed by GitHub
parent 3a8e8ecab9
commit 2204157ac0
13 changed files with 60 additions and 37 deletions

View File

@@ -2,6 +2,7 @@ import app from 'flarum/forum/app';
import { extend, override } from 'flarum/common/extend';
import IndexSidebar from 'flarum/forum/components/IndexSidebar';
import classList from 'flarum/common/utils/classList';
import Button from 'flarum/common/components/Button';
import tagsLabel from '../common/helpers/tagsLabel';
import getSelectableTags from './utils/getSelectableTags';
@@ -47,13 +48,16 @@ export default function addTagComposer() {
items.add(
'tags',
<a className={classList(['DiscussionComposer-changeTags', !selectableTags.length && 'disabled'])} onclick={this.chooseTags.bind(this)}>
<Button
className={classList(['DiscussionComposer-changeTags', 'Button Button--ua-reset', !selectableTags.length && 'disabled'])}
onclick={this.chooseTags.bind(this)}
>
{tags.length ? (
tagsLabel(tags)
) : (
<span className="TagLabel untagged">{app.translator.trans('flarum-tags.forum.composer_discussion.choose_tags_link')}</span>
)}
</a>,
</Button>,
10
);
});

View File

@@ -32,6 +32,7 @@
}
.DiscussionComposer-changeTags {
margin-right: 15px;
line-height: inherit;
&.disabled {
opacity: 0.5;