Skip to content

Commit 142bb93

Browse files
committed
fix: use v-if instead of v-show in TabPanel
1 parent cf27420 commit 142bb93

File tree

4 files changed

+1
-16
lines changed

4 files changed

+1
-16
lines changed

app/components/Compare/FacetScatterChart.vue

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import('vue-data-ui/style.css')
1111
const props = defineProps<{
1212
packagesData: ReadonlyArray<PackageComparisonData | null>
1313
packages: string[]
14-
isActiveTab: boolean
1514
}>()
1615
1716
const colorMode = useColorMode()
@@ -289,17 +288,6 @@ onMounted(async () => {
289288
await nextTick()
290289
readyTeleport.value = true
291290
})
292-
293-
// When he tab contents are hidden through v-show on load, the chart is mounted, but its internal autosizing feature trigger on an empty size, which leads to overlapping between scale labels and axis label on Y. This triggers a re-render of the chart when the tab is active.
294-
watch(
295-
() => props.isActiveTab,
296-
isActive => {
297-
if (isActive) {
298-
step.value += 1
299-
}
300-
},
301-
{ flush: 'post' },
302-
)
303291
</script>
304292

305293
<template>

app/components/Tab/Panel.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const resolvedTabId = computed(() => getTabId(props.value))
2121

2222
<template>
2323
<div
24-
v-show="isSelected"
24+
v-if="isSelected"
2525
:id="resolvedPanelId"
2626
role="tabpanel"
2727
:aria-labelledby="resolvedTabId"

app/pages/compare.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,6 @@ useSeoMeta({
455455
v-if="packages.length"
456456
:packages-data="packagesData"
457457
:packages="packages.filter(p => p !== NO_DEPENDENCY_ID)"
458-
:is-active-tab="comparisonView === 'charts'"
459458
/>
460459
</div>
461460
</TabPanel>

test/nuxt/a11y.spec.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1021,7 +1021,6 @@ describe('component accessibility audits', () => {
10211021
it('should have no accessibility violations', async () => {
10221022
const wrapper = await mountSuspended(FacetScatterChart, {
10231023
props: {
1024-
isActiveTab: true,
10251024
packagesData: [
10261025
{
10271026
package: {
@@ -1118,7 +1117,6 @@ describe('component accessibility audits', () => {
11181117
it('should have no accessibility violations with empty data', async () => {
11191118
const wrapper = await mountSuspended(FacetScatterChart, {
11201119
props: {
1121-
isActiveTab: true,
11221120
packagesData: [],
11231121
packages: [],
11241122
},

0 commit comments

Comments
 (0)