Skip to content

Commit

Permalink
fix(RecentPagesWidget): Set aria-label expand/collape link element
Browse files Browse the repository at this point in the history
Also use `v-show` instead of `v-if` for recent pages to solve issues
with registering events on its element.

Signed-off-by: Jonas <jonas@freesources.org>
  • Loading branch information
mejo- committed Sep 25, 2023
1 parent bec49ae commit c34ad81
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/components/Page/LandingPageWidgets/RecentPagesWidget.vue
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
<template>
<div class="recent-pages-widget">
<a class="recent-pages-title"
:aria-label="expandLabel"
@keydown.enter="toggleWidget"
@click="toggleWidget">
<WidgetHeading :title="t('collectives', 'Recent pages')" />
<div class="toggle-icon">
<ChevronDownButton :size="24"
:title="t('collectives', 'Expand recent pages')"
:class="{ 'collapsed': !showRecentPages }" />
</div>
</a>
<div v-if="showRecentPages" class="recent-pages-widget-container">
<div v-show="showRecentPages" class="recent-pages-widget-container">
<div ref="pageslider" class="recent-pages-widget-pages">
<RecentPageTile v-for="page in trimmedRecentPages"
:key="page.id"
Expand Down Expand Up @@ -67,6 +67,12 @@ export default {
'recentPages',
]),
expandLabel() {
return this.showRecentPages
? t('collectives', 'Collapse recent pages')
: t('collectives', 'Expand recent pages')
},
showRecentPages() {
return this.currentCollective.userShowRecentPages ?? true
},
Expand Down

0 comments on commit c34ad81

Please sign in to comment.