@@ -27,26 +27,28 @@ const ARROW_HEIGHT = 18;
27
27
const ARROW_WIDTH = 50 ;
28
28
const GAP = 16 ;
29
29
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.
38
31
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`;
41
40
42
- document . body . appendChild ( copyContainer ) ;
41
+ // const clone = element.cloneNode(true) as HTMLElement;
42
+ // copyContainer.appendChild(clone);
43
43
44
- return copyContainer ;
45
- } ;
44
+ // document.body.appendChild(copyContainer);
46
45
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
+ // };
50
52
51
53
export const Onboarding : React . FC < Props > = ( { steps, onComplete } ) => {
52
54
const media = useMedia ( ) ;
@@ -59,7 +61,7 @@ export const Onboarding: React.FC<Props> = ({ steps, onComplete }) => {
59
61
const stepRef = useRef < HTMLDivElement > ( null ) ;
60
62
const stepArrowRef = useRef < HTMLImageElement > ( null ) ;
61
63
const targetRef = useRef < HTMLElement | null > ( null ) ;
62
- const targetCopyRef = useRef < HTMLElement | null > ( null ) ;
64
+ // const targetCopyRef = useRef<HTMLElement | null>(null);
63
65
64
66
const calculatePosition = ( ) => {
65
67
if ( steps . length === 0 || ! stepRef . current ) return ;
@@ -76,7 +78,7 @@ export const Onboarding: React.FC<Props> = ({ steps, onComplete }) => {
76
78
const { width : stepWidth , height : stepHeight } = stepRef . current . getBoundingClientRect ( ) ;
77
79
78
80
// 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);
80
82
81
83
const stepPossibleLeft = left + width - stepWidth ;
82
84
const maxLeft = window . innerWidth - GAP - stepWidth ;
@@ -126,10 +128,10 @@ export const Onboarding: React.FC<Props> = ({ steps, onComplete }) => {
126
128
} , [ steps , currentStepIndex ] ) ;
127
129
128
130
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
+ // }
133
135
134
136
if ( currentStepIndex < totalSteps - 1 ) {
135
137
setCurrentStepIndex ( currentStepIndex + 1 ) ;
0 commit comments