From 1af2f954543473b6a21a1f51f949422bb542425c Mon Sep 17 00:00:00 2001 From: roshniahuja Date: Wed, 2 Apr 2025 19:10:54 +0530 Subject: [PATCH 1/3] Added Set time out for update height function. Signed-off-by: roshniahuja --- src/slider/tp-slider.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/slider/tp-slider.ts b/src/slider/tp-slider.ts index 9c5409b..70b08fb 100644 --- a/src/slider/tp-slider.ts +++ b/src/slider/tp-slider.ts @@ -319,7 +319,10 @@ export class TPSliderElement extends HTMLElement { } // First, update the height. - this.updateHeight(); + setTimeout( () => { + // Update Height. + this.updateHeight(); + }, 0 ); // Now lets slide! const behaviour: string = this.getAttribute( 'behaviour' ) || ''; From 83a7285657bb07072582fd8b6aaebd0e81108257 Mon Sep 17 00:00:00 2001 From: roshniahuja Date: Thu, 3 Apr 2025 12:58:09 +0530 Subject: [PATCH 2/3] Changed set timeout structure. Signed-off-by: roshniahuja --- src/slider/tp-slider.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/slider/tp-slider.ts b/src/slider/tp-slider.ts index 70b08fb..6fa304f 100644 --- a/src/slider/tp-slider.ts +++ b/src/slider/tp-slider.ts @@ -319,10 +319,8 @@ export class TPSliderElement extends HTMLElement { } // First, update the height. - setTimeout( () => { - // Update Height. - this.updateHeight(); - }, 0 ); + // Yield to main thread to fix a bug in Safari 16. + setTimeout( this.updateHeight.bind( this ), 10 ); // Now lets slide! const behaviour: string = this.getAttribute( 'behaviour' ) || ''; From db87897ed84a1b8b13463c7f586bf3a1ed84b6cd Mon Sep 17 00:00:00 2001 From: roshniahuja Date: Fri, 4 Apr 2025 12:43:21 +0530 Subject: [PATCH 3/3] Changed structure of set timeout. Signed-off-by: roshniahuja --- src/slider/tp-slider.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/slider/tp-slider.ts b/src/slider/tp-slider.ts index 6fa304f..530fa2c 100644 --- a/src/slider/tp-slider.ts +++ b/src/slider/tp-slider.ts @@ -319,8 +319,9 @@ export class TPSliderElement extends HTMLElement { } // First, update the height. + // Yield to main thread to fix a bug in Safari 16. - setTimeout( this.updateHeight.bind( this ), 10 ); + setTimeout( () => this.updateHeight(), 0 ); // Now lets slide! const behaviour: string = this.getAttribute( 'behaviour' ) || '';