Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stable30] fix(calls): media settings tabs animation #14350

Merged
merged 1 commit into from
Feb 11, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 1 addition & 23 deletions src/components/MediaSettings/MediaSettingsTabs.vue
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,6 @@ const isOpen = ref(!!props.active)
const randomId = Math.random().toString(36).substring(7)
const getRefId = (scope: 'tab' | 'panel', key: string) => `tab-${randomId}-${scope}-${key}`

/**
* Whether the tab panel horizontal transition is enabled.
* Used to prevent the panel switch transition when the tab is first rendered.
*/
const enableTransition = ref(false)

/** Index of the active tab for the transition effect */
const activeIndex = computed(() => props.tabs.findIndex(tab => tab.id === props.active))

Expand Down Expand Up @@ -73,23 +67,13 @@ function handleTabClick(tabId: string) {
}
}

/**
* Handle the tab panel opening transition finish
*/
function handleTabsAfterOpen() {
// Enable horizontal slide transition only after the tab panel is fully open
// Otherwise it slides to the active tab during opening
enableTransition.value = true
}

/**
* Handle the tab panel closing transition finish
*/
function handleTabsAfterClosed() {
// Emit tab change to none only when the tab panel is fully closed
// Otherwise visually open tab disappears with transition during closing
emit('update:active', undefined)
enableTransition.value = false
}
</script>

Expand All @@ -114,14 +98,12 @@ function handleTabsAfterClosed() {

<TransitionExpand :show="isOpen"
direction="vertical"
@after-enter="handleTabsAfterOpen"
@after-leave="handleTabsAfterClosed">
<div class="tab-panels-container">
<div v-for="tab in tabs"
:id="getRefId('panel', tab.id)"
:key="tab.id"
class="tab-panel"
:class="{ 'tab-panel--with-transition': enableTransition }"
role="tabpanel"
:inert="!isActive(tab.id)"
:aria-hidden="!isActive(tab.id)"
Expand Down Expand Up @@ -152,10 +134,6 @@ function handleTabsAfterClosed() {
.tab-panel {
width: 100%;
flex: 1 0 100%;
transition: none;

&--with-transition {
transition: transform ease var(--animation-slow);
}
transition: transform ease var(--animation-slow);
}
</style>
Loading