Skip to content

A platform for community discussion. Free, open, simple.

UX: do not tab to an already active tab (#30531)

Joffrey JAFFEUX9b7fc3797e48
diff --git a/app/assets/javascripts/discourse/app/components/more-topics.gjs b/app/assets/javascripts/discourse/app/components/more-topics.gjs
index e14c77be195..c34577fd11c 100644
--- a/app/assets/javascripts/discourse/app/components/more-topics.gjs
+++ b/app/assets/javascripts/discourse/app/components/more-topics.gjs
@@ -64,6 +64,11 @@ export default class MoreTopics extends Component {
});
}
+ @action
+ isActiveTab(tab) {
+ return tab?.id === this.selectedTab?.id;
+ }
+
<template>
<div class="more-topics__container">
{{#if (gt this.tabs.length 1)}}
@@ -76,7 +81,8 @@ export default class MoreTopics extends Component {
@translatedLabel={{tab.name}}
@translatedTitle={{tab.name}}
@icon={{tab.icon}}
- class={{if (eq tab.id this.activeTab.id) "active"}}
+ class={{if (this.isActiveTab tab) "active"}}
+ tabindex={{if (this.isActiveTab tab) -1 0}}
/>
</li>
{{/each}}