From 84fecd370c2c549772176d79c850e056d27aaa90 Mon Sep 17 00:00:00 2001 From: Kris Date: Tue, 19 Nov 2024 15:38:03 -0500 Subject: [PATCH] A11Y: convert sortable topic list headers to proper buttons (#29808) --- .../discourse/app/components/topic-list.js | 1 + .../topic-list/topic-list-header-column.gjs | 23 ++++++++++--------- .../topic-list-header-column.hbr | 16 +++++++++---- .../stylesheets/common/base/discourse.scss | 5 ++++ 4 files changed, 30 insertions(+), 15 deletions(-) diff --git a/app/assets/javascripts/discourse/app/components/topic-list.js b/app/assets/javascripts/discourse/app/components/topic-list.js index af01cd984f9..3044243f61a 100644 --- a/app/assets/javascripts/discourse/app/components/topic-list.js +++ b/app/assets/javascripts/discourse/app/components/topic-list.js @@ -220,6 +220,7 @@ export default class TopicList extends Component.extend(LoadMore) { }; onKeyDown("th.sortable", (element) => { + e.preventDefault(); this.changeSort(element.dataset.sortOrder); this.rerender(); }); diff --git a/app/assets/javascripts/discourse/app/components/topic-list/topic-list-header-column.gjs b/app/assets/javascripts/discourse/app/components/topic-list/topic-list-header-column.gjs index ea65bc19d79..833e1ce71f4 100644 --- a/app/assets/javascripts/discourse/app/components/topic-list/topic-list-header-column.gjs +++ b/app/assets/javascripts/discourse/app/components/topic-list/topic-list-header-column.gjs @@ -123,20 +123,21 @@ export default class TopicListHeaderColumn extends Component { @changeNewListSubset={{@changeNewListSubset}} /> {{else}} - - {{this.localizedName}} - + {{#if @sortable}} + + {{else}} + + {{this.localizedName}} + + {{/if}} {{/if}} {{/unless}} - {{#if this.isSorting}} - {{icon (if @ascending "chevron-up" "chevron-down")}} - {{/if}} {{view.localizedName}} + {{#if sortable}} + + {{else}} + + {{view.localizedName}} + + {{/if}} {{/if ~}} {{/unless ~}} - {{~#if view.isSorting}} - {{d-icon view.sortIcon}} - {{/if ~}} {{~plugin-outlet name="topic-list-heading-bottom" outletArgs=(raw-hash name=view.name bulkSelectEnabled=bulkSelectEnabled)~}} diff --git a/app/assets/stylesheets/common/base/discourse.scss b/app/assets/stylesheets/common/base/discourse.scss index ab8a592eeea..86af3a93392 100644 --- a/app/assets/stylesheets/common/base/discourse.scss +++ b/app/assets/stylesheets/common/base/discourse.scss @@ -312,6 +312,11 @@ textarea { } @include unselectable; cursor: pointer; + + button { + background: none; + border: none; + } } .radio,