@@ -27,26 +27,28 @@ const ARROW_HEIGHT = 18;
2727const ARROW_WIDTH = 50 ;
2828const GAP = 16 ;
2929
30- const createOverlayCopy = ( element : HTMLElement ) : HTMLElement => {
31- const copyContainer = document . createElement ( "div" ) ;
32- copyContainer . style . position = "absolute" ;
33- copyContainer . style . zIndex = "10000" ;
34- copyContainer . style . top = `${ element . getBoundingClientRect ( ) . top } px` ;
35- copyContainer . style . left = `${ element . getBoundingClientRect ( ) . left } px` ;
36- copyContainer . style . width = `${ element . offsetWidth } px` ;
37- copyContainer . style . height = `${ element . offsetHeight } px` ;
30+ // TODO: There seems to be a serious problem on mobile devices. We need to figure out why there’s such jittering when highlighting elements.
3831
39- const clone = element . cloneNode ( true ) as HTMLElement ;
40- copyContainer . appendChild ( clone ) ;
32+ // const createOverlayCopy = (element: HTMLElement): HTMLElement => {
33+ // const copyContainer = document.createElement("div");
34+ // copyContainer.style.position = "absolute";
35+ // copyContainer.style.zIndex = "10000";
36+ // copyContainer.style.top = `${element.getBoundingClientRect().top}px`;
37+ // copyContainer.style.left = `${element.getBoundingClientRect().left}px`;
38+ // copyContainer.style.width = `${element.offsetWidth}px`;
39+ // copyContainer.style.height = `${element.offsetHeight}px`;
4140
42- document . body . appendChild ( copyContainer ) ;
41+ // const clone = element.cloneNode(true) as HTMLElement;
42+ // copyContainer.appendChild(clone);
4343
44- return copyContainer ;
45- } ;
44+ // document.body.appendChild(copyContainer);
4645
47- const removeOverlayCopy = ( copyContainer : HTMLElement ) => {
48- document . body . removeChild ( copyContainer ) ;
49- } ;
46+ // return copyContainer;
47+ // };
48+
49+ // const removeOverlayCopy = (copyContainer: HTMLElement) => {
50+ // document.body.removeChild(copyContainer);
51+ // };
5052
5153export const Onboarding : React . FC < Props > = ( { steps, onComplete } ) => {
5254 const media = useMedia ( ) ;
@@ -59,7 +61,7 @@ export const Onboarding: React.FC<Props> = ({ steps, onComplete }) => {
5961 const stepRef = useRef < HTMLDivElement > ( null ) ;
6062 const stepArrowRef = useRef < HTMLImageElement > ( null ) ;
6163 const targetRef = useRef < HTMLElement | null > ( null ) ;
62- const targetCopyRef = useRef < HTMLElement | null > ( null ) ;
64+ // const targetCopyRef = useRef<HTMLElement | null>(null);
6365
6466 const calculatePosition = ( ) => {
6567 if ( steps . length === 0 || ! stepRef . current ) return ;
@@ -76,7 +78,7 @@ export const Onboarding: React.FC<Props> = ({ steps, onComplete }) => {
7678 const { width : stepWidth , height : stepHeight } = stepRef . current . getBoundingClientRect ( ) ;
7779
7880 // Create a copy of the target element and place it at the top of the DOM
79- targetCopyRef . current = createOverlayCopy ( targetRef . current ) ;
81+ // targetCopyRef.current = createOverlayCopy(targetRef.current);
8082
8183 const stepPossibleLeft = left + width - stepWidth ;
8284 const maxLeft = window . innerWidth - GAP - stepWidth ;
@@ -126,10 +128,10 @@ export const Onboarding: React.FC<Props> = ({ steps, onComplete }) => {
126128 } , [ steps , currentStepIndex ] ) ;
127129
128130 const handleNextStep = ( ) => {
129- if ( targetCopyRef . current ) {
130- // Remove the copied element when no longer needed
131- removeOverlayCopy ( targetCopyRef . current ) ;
132- }
131+ // if (targetCopyRef.current) {
132+ // // Remove the copied element when no longer needed
133+ // removeOverlayCopy(targetCopyRef.current);
134+ // }
133135
134136 if ( currentStepIndex < totalSteps - 1 ) {
135137 setCurrentStepIndex ( currentStepIndex + 1 ) ;
0 commit comments