Skip to content

Conversation

@YashSikarwar28
Copy link

@YashSikarwar28 YashSikarwar28 commented Oct 11, 2025

Resolves #4463

11.10.2025_23.20.29_REC.mp4

Description

  • Updated the existing "Back to Top" scroll button component.
  • Modified logic to ensure the button only appears when the user scrolls to the bottom of the page, instead of on every scroll.
  • Applied visual improvements to the button:
    • Changed background color to purple (bg-purple-600) with hover effect.
    • Ensured perfect circular shape using Tailwind classes (rounded-full, h-12, w-12).
  • Tested functionality across various screen sizes and ensured no layout conflicts.

Summary by CodeRabbit

  • New Behavior

    • Back-to-top button now appears only at the bottom of the page and scrolls smoothly to the top on click.
  • Style

    • Replaced image UI with a compact circular emoji-like button and improved accessibility via an aria-label.
  • Refactor

    • More reliable scroll handling with throttling, initial mount check, and proper listener management.
  • Documentation

    • Cleaned and standardized community docs and policies; converted roadmap into a table.
  • Chores

    • Added TypeScript environment references; JSON file reformatted without behavioral changes.

@netlify
Copy link

netlify bot commented Oct 11, 2025

Deploy Preview for asyncapi-website ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 083b7f4
🔍 Latest deploy log https://app.netlify.com/projects/asyncapi-website/deploys/68ebd9ba0be326000897d7ad
😎 Deploy Preview https://deploy-preview-4464--asyncapi-website.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Welcome to AsyncAPI. Thanks a lot for creating your first pull request. Please check out our contributors guide useful for opening a pull request.
Keep in mind there are also other channels you can use to interact with AsyncAPI community. For more details check out this issue.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 11, 2025

Walkthrough

Converts ScrollButton to a typed React functional component that only shows when the user is at the bottom of the page (throttled scroll detection, smooth scroll-to-top). Adds Next.js triple-slash type references and reformats several Markdown docs; minor JSON reformatting in mlc_config.json.

Changes

Cohort / File(s) Summary
Scroll button refactor & behavior
components/buttons/ScrollButton.tsx
Converted to const ScrollButton: React.FC = () => { ... } default export; replaced image with inline emoji/button, added bottom-of-page detection using window.innerHeight, window.pageYOffset, document.documentElement.scrollHeight, introduced throttled scroll handler that runs on mount with cleanup, early-return when not at bottom, and scrollToTop smooth action.
Next.js type references
next-env.d.ts
Added TypeScript triple-slash reference directives for Next.js core types, image types, and generated route types; kept standard "do not edit" note.
Docs formatting (community)
markdown/docs/community/060-meetings-and-communication/docs-community.md, markdown/docs/community/COC-incident-resolution-procedures.md
Rewrote front matter and normalized Markdown structure: replaced misformatted lists with standard headers and nested lists; converted a hyphen-style roadmap into a pipe-delimited table; content preserved, formatting improved.
Config reformat (no semantic change)
mlc_config.json
JSON reformatting/pretty-printing only; no semantic changes to fields or values.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant U as User
  participant W as Window
  participant SB as ScrollButton
  participant D as Document

  Note over SB: Mount
  SB->>W: addEventListener('scroll', throttled handleScroll)
  SB->>SB: run handleScroll() once on mount

  W->>SB: scroll event (throttled)
  SB->>D: read pageYOffset, innerHeight, documentElement.scrollHeight
  alt at-bottom
    SB-->>U: render circular fixed button (emoji)
  else not-at-bottom
    SB-->>U: render null
  end

  U->>SB: click button
  SB->>W: window.scrollTo({ top: 0, behavior: 'smooth' })

  Note over SB: Unmount
  SB->>W: removeEventListener('scroll', handleScroll)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested labels

ready-to-merge

Suggested reviewers

  • derberg
  • akshatnema
  • magicmatatjahu
  • anshgoyalevil
  • sambhavgupta0705

Poem

A hop, a peek beneath the fold,
I wait until the page is told.
Tap my paw and up we stream,
Smooth as clover, swift the dream.
— your cheerful rabbit 🐇⬆️

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Out of Scope Changes Check ⚠️ Warning This pull request also includes unrelated documentation formatting updates to several markdown files, a reformat of mlc_config.json, and modifications to next-env.d.ts, none of which pertain to fixing the “Back to Top” button behavior. These additions fall outside the scope of resolving issue #4463 and dilute the focus of the changeset. Please remove or separate the documentation and environment file changes into a different pull request so that this PR remains focused solely on the Back to Top button logic and styling updates required by issue #4463.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title succinctly describes the core change of this pull request by indicating that the “Back to Top” button will now only appear when the user is at the bottom of the page, matching the main update implemented in the code. It uses clear, concise wording without extraneous details or noise. This makes it easy for collaborators to understand the primary purpose at a glance.
Linked Issues Check ✅ Passed The changes satisfy the objectives of issue #4463 by preventing the button from appearing immediately on scroll and only displaying it once the user has reached the bottom of the page, which fulfills the requirement to show the control after a significant portion of content has been viewed. The implementation aligns with one of the suggested UX patterns and the functional behavior has been updated accordingly.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@YashSikarwar28 YashSikarwar28 changed the title BUG - Fix Show back to top button at bottom fix: Show back to top button at bottom Oct 11, 2025
@YashSikarwar28 YashSikarwar28 changed the title fix: Show back to top button at bottom fix: show back to top button at bottom Oct 11, 2025
@asyncapi-bot
Copy link
Contributor

asyncapi-bot commented Oct 11, 2025

⚡️ Lighthouse report for the changes in this PR:

Category Score
🔴 Performance 38
🟢 Accessibility 98
🟢 Best practices 92
🟢 SEO 100
🔴 PWA 33

Lighthouse ran on https://deploy-preview-4464--asyncapi-website.netlify.app/

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 5

🧹 Nitpick comments (2)
components/buttons/ScrollButton.tsx (2)

7-13: Add debouncing or throttling to the scroll event handler.

The scroll event fires very frequently during scrolling, potentially causing performance issues. Consider throttling the handler to limit executions.

Here's an example using a simple throttle approach:

+  const [isBottom, setIsBottom] = useState(false);
+
+  useEffect(() => {
+    let timeoutId: NodeJS.Timeout | null = null;
+
     const handleScroll = () => {
+      if (timeoutId) return;
+      
+      timeoutId = setTimeout(() => {
+        const scrollTop = window.scrollY || document.documentElement.scrollTop;
+        const windowHeight = window.innerHeight;
+        const fullHeight = document.documentElement.scrollHeight;
+
+        setIsBottom(scrollTop + windowHeight >= fullHeight - 10);
+        timeoutId = null;
+      }, 100);
-      const scrollTop = window.scrollY || document.documentElement.scrollTop;
-      const windowHeight = window.innerHeight;
-      const fullHeight = document.documentElement.scrollHeight;
-
-      setIsBottom(scrollTop + windowHeight >= fullHeight - 10);
     };

31-31: Consider using an icon component instead of Unicode arrow.

The Unicode arrow (↑) may render inconsistently across different browsers, operating systems, and font configurations. Consider using an SVG icon or an icon library for better visual consistency and accessibility.

Example using an SVG arrow:

-
+      <svg
+        className='h-6 w-6'
+        fill='none'
+        stroke='currentColor'
+        viewBox='0 0 24 24'
+        xmlns='http://www.w3.org/2000/svg'
+      >
+        <path strokeLinecap='round' strokeLinejoin='round' strokeWidth={2} d='M5 10l7-7m0 0l7 7m-7-7v18' />
+      </svg>
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 19e3c34 and 596d044.

📒 Files selected for processing (2)
  • components/buttons/ScrollButton.tsx (1 hunks)
  • next-env.d.ts (1 hunks)
🧰 Additional context used
🪛 GitHub Actions: PR testing - if Node project
next-env.d.ts

[error] Process completed with exit code 1.

components/buttons/ScrollButton.tsx

[warning] 3-3: Missing JSDoc comment. require-jsdoc


[error] 28-28: max-len: This line has a length of 188. Maximum allowed is 120.


[error] 28-28: prettier/prettier: Replace "fixed bottom-6 right-6 ... text-lg" with 'fixed bottom-6 right-6 ... text-lg'.


[error] 28-28: jsx-quotes: Unexpected usage of doublequote.


[error] 29-29: prettier/prettier: Replace "Scroll to top" with 'Scroll to top'.


[error] 29-29: jsx-quotes: Unexpected usage of doublequote.


[error] 34-34: prettier/prettier: Delete newline character.


[error] 36-36: no-multiple-empty-lines: More than 1 blank line not allowed.


[error] Process completed with exit code 1.

⏰ Context from checks skipped due to timeout of 180000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: Redirect rules - asyncapi-website
  • GitHub Check: Header rules - asyncapi-website
  • GitHub Check: Pages changed - asyncapi-website
  • GitHub Check: Lighthouse CI

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 596d044 and b3a7576.

📒 Files selected for processing (1)
  • components/buttons/ScrollButton.tsx (1 hunks)
🧰 Additional context used
🪛 GitHub Actions: PR testing - if Node project
components/buttons/ScrollButton.tsx

[error] 13-13: ESLint: Expected blank line after variable declarations. newline-after-var


[error] 14-14: ESLint: Expected blank line before this statement. padding-line-between-statements


[error] 21-21: ESLint: 'NodeJS' is not defined. no-undef

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

♻️ Duplicate comments (1)
components/buttons/ScrollButton.tsx (1)

23-30: Replace NodeJS.Timeout with ReturnType<typeof setTimeout>.

The browser bundle doesn’t expose the NodeJS namespace, so ESLint flags this spot (no-undef) and the build breaks. Switch the declaration to let throttleTimeout: ReturnType<typeof setTimeout> | null = null; (and keep the null checks/clearTimeout logic) to stay DOM-safe.

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b3a7576 and fcdd39c.

⛔ Files ignored due to path filters (25)
  • public/img/illustrations/icons/doc-sync.svg is excluded by !**/*.svg
  • public/img/illustrations/icons/help.svg is excluded by !**/*.svg
  • public/img/illustrations/icons/laptop-cloud.svg is excluded by !**/*.svg
  • public/img/illustrations/icons/laptop-globe.svg is excluded by !**/*.svg
  • public/img/illustrations/icons/maternity.svg is excluded by !**/*.svg
  • public/img/illustrations/icons/mobile-feed.svg is excluded by !**/*.svg
  • public/img/illustrations/icons/mouse-globe.svg is excluded by !**/*.svg
  • public/img/illustrations/icons/open-source.svg is excluded by !**/*.svg
  • public/img/illustrations/icons/plug-cloud.svg is excluded by !**/*.svg
  • public/img/illustrations/icons/robotic.svg is excluded by !**/*.svg
  • public/img/illustrations/icons/tools.svg is excluded by !**/*.svg
  • public/img/illustrations/worker.svg is excluded by !**/*.svg
  • public/img/loaders/audio.svg is excluded by !**/*.svg
  • public/img/loaders/ball-triangle.svg is excluded by !**/*.svg
  • public/img/loaders/bars.svg is excluded by !**/*.svg
  • public/img/loaders/circles.svg is excluded by !**/*.svg
  • public/img/loaders/grid.svg is excluded by !**/*.svg
  • public/img/loaders/hearts.svg is excluded by !**/*.svg
  • public/img/loaders/oval.svg is excluded by !**/*.svg
  • public/img/loaders/puff.svg is excluded by !**/*.svg
  • public/img/loaders/rings.svg is excluded by !**/*.svg
  • public/img/loaders/spinning-circles.svg is excluded by !**/*.svg
  • public/img/loaders/tail-spin.svg is excluded by !**/*.svg
  • public/img/loaders/three-dots.svg is excluded by !**/*.svg
  • public/img/logos/asyncapi-horizontal-color.svg is excluded by !**/*.svg
📒 Files selected for processing (4)
  • components/buttons/ScrollButton.tsx (1 hunks)
  • markdown/docs/community/060-meetings-and-communication/docs-community.md (1 hunks)
  • markdown/docs/community/COC-incident-resolution-procedures.md (1 hunks)
  • mlc_config.json (1 hunks)
✅ Files skipped from review due to trivial changes (3)
  • markdown/docs/community/COC-incident-resolution-procedures.md
  • markdown/docs/community/060-meetings-and-communication/docs-community.md
  • mlc_config.json
🧰 Additional context used
🪛 GitHub Actions: PR testing - if Node project
components/buttons/ScrollButton.tsx

[error] 1-1: ESLint: Expected space or tab after '//' in comment. (spaced-comment)


[error] 23-23: ESLint: 'NodeJS' is not defined. (no-undef)

⏰ Context from checks skipped due to timeout of 180000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: Redirect rules - asyncapi-website
  • GitHub Check: Header rules - asyncapi-website
  • GitHub Check: Pages changed - asyncapi-website

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] <description> "Back To Top" Button Appears on Scroll and Distracts User Experience

3 participants