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

This commit is contained in:
Joffrey JAFFEUX 2025-01-02 12:28:57 +01:00 committed by GitHub
parent 80cda1212e
commit 9b7fc3797e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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}}