fix: ref transitions for firefox

This commit is contained in:
SrGooglo 2023-10-10 12:10:01 +00:00
parent 8be2a0279d
commit 04a72c80b2

View File

@ -124,7 +124,6 @@ export class PagePanelWithNavMenu extends React.Component {
return React.createElement(tab.component, { return React.createElement(tab.component, {
...componentProps, ...componentProps,
ref: this.primaryPanelRef,
}) })
} }
@ -160,13 +159,15 @@ export class PagePanelWithNavMenu extends React.Component {
console.warn("PagePanelWithNavMenu: transition is enabled but document.startViewTransition is not compatible with your browser") console.warn("PagePanelWithNavMenu: transition is enabled but document.startViewTransition is not compatible with your browser")
// set to primary panel fade-opacity-leave class if (this.primaryPanelRef.current && this.primaryPanelRef.current?.classList) {
this.primaryPanelRef.current.classList.add("fade-opacity-leave") // set to primary panel fade-opacity-leave class
this.primaryPanelRef.current.classList.add("fade-opacity-leave")
// remove fade-opacity-leave class after animation // remove fade-opacity-leave class after animation
setTimeout(() => { setTimeout(() => {
this.primaryPanelRef.current.classList.remove("fade-opacity-leave") this.primaryPanelRef.current.classList.remove("fade-opacity-leave")
}, 300) }, 300)
}
await new Promise(resolve => setTimeout(resolve, 200)) await new Promise(resolve => setTimeout(resolve, 200))
} }
@ -226,7 +227,7 @@ export class PagePanelWithNavMenu extends React.Component {
} }
<div className="pagePanels"> <div className="pagePanels">
<div className="panel"> <div className="panel" ref={this.primaryPanelRef}>
{ {
this.renderActiveTab() this.renderActiveTab()
} }