diff --git a/src/components/ui/Tab.scss b/src/components/ui/Tab.scss index ba3de5f0b..7044275a6 100644 --- a/src/components/ui/Tab.scss +++ b/src/components/ui/Tab.scss @@ -29,8 +29,16 @@ } } - &:not(&--active):hover { - background: var(--color-interactive-element-hover); + @media (hover:hover) { + &:not(&--active):hover { + background: var(--color-interactive-element-hover); + } + } + + @media (max-width: 600px) { + &:not(&--active):active { + background: var(--color-interactive-element-hover); + } } > span { diff --git a/src/components/ui/Tab.tsx b/src/components/ui/Tab.tsx index eb5850a32..cee72e911 100644 --- a/src/components/ui/Tab.tsx +++ b/src/components/ui/Tab.tsx @@ -38,6 +38,11 @@ const Tab: FC = ({ const tabRef = useRef(null); useEffect(() => { + // Set initial active state + if (isActive && previousActiveTab === undefined && tabRef.current) { + tabRef.current.classList.add(classNames.active); + } + if (!isActive || previousActiveTab === undefined) { return; } diff --git a/src/components/ui/Transition.scss b/src/components/ui/Transition.scss index 5f8a04319..4474bc71d 100644 --- a/src/components/ui/Transition.scss +++ b/src/components/ui/Transition.scss @@ -28,8 +28,11 @@ */ &.slide-optimized, &.slide-optimized-rtl { - // Create a new composite layer to reduce the page repaint area when switching a tab - transform: translate3d(0, 0, 0); + contain: strict; + body.is-safari & { + // Create a new composite layer to reduce the page repaint area when switching a tab (as `contain` is not supported in Safari) + transform: translate3d(0, 0, 0); + } #root & > div { position: absolute; diff --git a/src/components/ui/Transition.tsx b/src/components/ui/Transition.tsx index 388867550..c56baab91 100644 --- a/src/components/ui/Transition.tsx +++ b/src/components/ui/Transition.tsx @@ -260,7 +260,7 @@ const Transition: FC = ({ ref={containerRef} id={id} className={buildClassName('Transition', className, name)} - teactFastList={!shouldCleanup} + teactFastList={!renderCount && !shouldCleanup} > {contents} diff --git a/src/modules/actions/ui/initial.ts b/src/modules/actions/ui/initial.ts index f8296283d..7b82d1fd9 100644 --- a/src/modules/actions/ui/initial.ts +++ b/src/modules/actions/ui/initial.ts @@ -2,7 +2,7 @@ import { addReducer, getGlobal, setGlobal } from '../../../lib/teact/teactn'; import { ANIMATION_LEVEL_MAX } from '../../../config'; import { - IS_ANDROID, IS_IOS, IS_MAC_OS, IS_TOUCH_ENV, + IS_ANDROID, IS_IOS, IS_MAC_OS, IS_SAFARI, IS_TOUCH_ENV, } from '../../../util/environment'; import { setLanguage } from '../../../util/langProvider'; import switchTheme from '../../../util/switchTheme'; @@ -38,6 +38,9 @@ addReducer('init', (global) => { } else if (IS_MAC_OS) { document.body.classList.add('is-macos'); } + if (IS_SAFARI) { + document.body.classList.add('is-safari'); + } }); addReducer('setIsUiReady', (global, actions, payload) => {