diff --git a/js/src/forum/components/DiscussionListItem.js b/js/src/forum/components/DiscussionListItem.js index 3c3a5e85c..67d1cd950 100644 --- a/js/src/forum/components/DiscussionListItem.js +++ b/js/src/forum/components/DiscussionListItem.js @@ -13,7 +13,6 @@ import TerminalPost from './TerminalPost'; import SubtreeRetainer from '../../common/utils/SubtreeRetainer'; import DiscussionControls from '../utils/DiscussionControls'; import slidable from '../utils/slidable'; -import extractText from '../../common/utils/extractText'; import classList from '../../common/utils/classList'; import DiscussionPage from './DiscussionPage'; import escapeRegExp from '../../common/utils/escapeRegExp'; @@ -50,12 +49,11 @@ export default class DiscussionListItem extends Component { elementAttrs() { return { - className: classList([ - 'DiscussionListItem', - this.active() ? 'active' : '', - this.attrs.discussion.isHidden() ? 'DiscussionListItem--hidden' : '', - 'ontouchstart' in window ? 'Slidable' : '', - ]), + className: classList('DiscussionListItem', { + active: this.active(), + 'DiscussionListItem--hidden': this.attrs.discussion.isHidden(), + Slidable: 'ontouchstart' in window, + }), }; } @@ -64,7 +62,7 @@ export default class DiscussionListItem extends Component { const user = discussion.user(); const isUnread = discussion.isUnread(); const isRead = discussion.isRead(); - const showUnread = !this.showRepliesCount() && isUnread; + let jumpTo = 0; const controls = DiscussionControls.controls(discussion, this).toArray(); const attrs = this.elementAttrs(); @@ -83,17 +81,16 @@ export default class DiscussionListItem extends Component { return (
- {controls.length - ? Dropdown.component( - { - icon: 'fas fa-ellipsis-v', - className: 'DiscussionListItem-controls', - buttonClassName: 'Button Button--icon Button--flat Slidable-underneath Slidable-underneath--right', - accessibleToggleLabel: app.translator.trans('core.forum.discussion_controls.toggle_dropdown_accessible_label'), - }, - controls - ) - : ''} + {controls.length > 0 && + Dropdown.component( + { + icon: 'fas fa-ellipsis-v', + className: 'DiscussionListItem-controls', + buttonClassName: 'Button Button--icon Button--flat Slidable-underneath Slidable-underneath--right', + accessibleToggleLabel: app.translator.trans('core.forum.discussion_controls.toggle_dropdown_accessible_label'), + }, + controls + )} -
+
{highlight(discussion.title(), this.highlightRegExp)}
    {listItems(this.infoItems().toArray())}
- - - {abbreviateNumber(discussion[showUnread ? 'unreadCount' : 'replyCount']())} - + {this.replyCountItem()}
); @@ -222,4 +210,31 @@ export default class DiscussionListItem extends Component { return items; } + + replyCountItem() { + const discussion = this.attrs.discussion; + const showUnread = !this.showRepliesCount() && discussion.isUnread(); + + if (showUnread) { + return ( + + ); + } + + return ( + + + + + {app.translator.trans('core.forum.discussion_list.total_replies_a11y_label', { count: discussion.replyCount() })} + + + ); + } } diff --git a/less/common/Button.less b/less/common/Button.less index 3165f9af4..430145691 100644 --- a/less/common/Button.less +++ b/less/common/Button.less @@ -231,3 +231,36 @@ font-weight: bold; margin-left: 10px; } + +// Remove all user-agent styles from the Button +.Button--ua-reset { + border: none; + margin: 0; + padding: 0; + width: auto; + overflow: visible; + text-align: inherit; + vertical-align: inherit; + + background: transparent; + + /* inherit font & color from ancestor */ + color: inherit; + font: inherit; + + /* Normalize `line-height`. Cannot be changed from `normal` in Firefox 4+. */ + line-height: normal; + + /* Corrects font smoothing for webkit */ + -webkit-font-smoothing: inherit; + -moz-osx-font-smoothing: inherit; + + /* Corrects inability to style clickable `input` types in iOS */ + -webkit-appearance: none; + appearance: none; + + &::-moz-focus-inner { + border: 0; + padding: 0; + } +} diff --git a/locale/core.yml b/locale/core.yml index 807679061..3b7772d72 100644 --- a/locale/core.yml +++ b/locale/core.yml @@ -326,9 +326,10 @@ core: discussion_list: empty_text: It looks as though there are no discussions here. load_more_button: => core.ref.load_more - mark_as_read_tooltip: Mark as Read replied_text: "{username} replied {ago}" started_text: "{username} started {ago}" + total_replies_a11y_label: "{count, plural, one {# reply} other {# replies}}" + unread_replies_a11y_label: "{count, plural, one {# unread reply} other {# unread replies}}. Mark unread {count, plural, one {reply} other {replies}} as read." # These translations are used in the Forgot Password modal dialog. forgot_password: