File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -60,11 +60,12 @@ it("does not slide rows from positions measured before a window resize", () => {
6060 expect ( fixture . list . getAnimations ( { subtree : true } ) ) . toHaveLength ( 0 ) ;
6161} ) ;
6262
63- it ( "does not queue drag- release motion while the document is hidden" , ( ) => {
63+ it ( "does not replay a drag release that ended while the document was hidden" , ( ) => {
6464 using fixture = mountList ( [ "a" , "b" ] ) ;
65- using _visibility = vi . spyOn ( document , "visibilityState" , "get" ) . mockReturnValue ( "hidden" ) ;
65+ using visibility = vi . spyOn ( document , "visibilityState" , "get" ) . mockReturnValue ( "hidden" ) ;
6666 fixture . motion . release ( ) ;
67+ visibility . mockReturnValue ( "visible" ) ;
6768 fixture . list . prepend ( fixture . rows . get ( "b" ) ! ) ;
68- fixture . motion . update ( true ) ;
69+ fixture . motion . update ( false ) ;
6970 expect ( fixture . list . getAnimations ( { subtree : true } ) ) . toHaveLength ( 0 ) ;
7071} ) ;
Original file line number Diff line number Diff line change @@ -228,7 +228,7 @@ export function createSidebarListMotion(parent: HTMLUListElement) {
228228 }
229229 }
230230 if ( released !== null ) {
231- if ( document . visibilityState === "visible" && ! reducedMotion ?. matches ) {
231+ if ( ! reducedMotion ?. matches ) {
232232 for ( const [ node , position ] of next ) {
233233 const top = released . get ( node ) ;
234234 if ( top !== undefined ) move ( node , top - position . top ) ;
@@ -240,6 +240,7 @@ export function createSidebarListMotion(parent: HTMLUListElement) {
240240 } ,
241241 release ( ) {
242242 suspend ( ) ;
243+ if ( document . visibilityState !== "visible" ) return ;
243244 const origin = parent . getBoundingClientRect ( ) . top ;
244245 released = new Map (
245246 Array . from ( parent . children )
You can’t perform that action at this time.
0 commit comments