Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fixed duplicate scroll button Issue in safari browser #3392

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions components/buttons/ScrollButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,12 @@ function ScrollButton() {

return (
<div className='fixed bottom-14 right-4 z-40 h-16 w-12'>
{backToTopButton && (
<button className='rounded-full bg-white shadow-md ' onClick={scrollUp}>
<img src={scrollImage} alt='scroll to top' />
</button>
)}
<button
className={`rounded-full bg-white shadow-md ${backToTopButton ? 'visible' : 'pointer-events-none invisible'}`}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kind of confused as how these changes are leading to fix the error in safari?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The issue was due to an empty true condition, which led to unexpected behavior, img copies in DOM, By updating this condition to execute a specific action when true, we effectively resolved the issue as highlighted by codeRabbit. The issue and solution videos illustrate this difference clearly.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

onClick={scrollUp}
>
<img src={scrollImage} alt='scroll to top' />
</button>
</div>
);
}
Expand Down
Loading