Skip to content

Conversation

@Siddharth22GIT
Copy link

@Siddharth22GIT Siddharth22GIT commented Dec 2, 2025

What does this PR do?

fixes the X (Twitter) icon not appearing and resolves incorrect color behavior in the navbar during scroll.

Changes Made

  • Added working img/x-logo.svg
  • Navbar icon is white at top, black when scrolled
  • Footer icon remains black (correct for white background)
  • Updated custom.css to handle invert logic for navbar vs footer
  • Updated scripts.js to remove forced show-content flash and apply proper scroll logic
  • Updated all HTML references in header + footer

Screenshots

Please find the before/after screenshots and optional demo video below:

Before:
X icon missing in header
Screenshot 2025-12-02 231527

After:
X icon visible and styled correctly
Smooth color transition on scroll
Screenshot 2025-12-03 020327

Screen.Recording.2025-12-03.020414.mp4

Related Issue

Closes #902

Tested On

  • index.html
  • 404.html
  • 500.html
  • coc/index.html
  • labs/index.html
  • licenses/index.html

All pages show the correct behavior now.

Summary by Sourcery

Update social media icon assets and scroll behavior so the X (Twitter) logo displays consistently and navbar icon colors change correctly on scroll across site pages.

New Features:

  • Add an SVG asset and shared CSS class for the X (Twitter) logo used across navigation, footer, and social sections.

Bug Fixes:

  • Fix missing X (Twitter) icon by replacing legacy font icon references with the new SVG-based logo on all affected pages.
  • Correct navbar social icon color behavior so icons appear white at the top of the page and switch to black after scrolling while keeping footer icons consistently black.

Enhancements:

  • Refine scroll handling logic to derive navbar state from scroll position instead of forcing the show-content class on load, preventing visual flashes and ensuring smoother transitions.

- added new x-logo.svg
- fixed header icon color swap (white → black on scroll)
- ensured footer icon stays black
- updated custom.css and scripts.js to properly handle invert + scroll classes
- updated all HTML files to reference the SVG correctly

Closes fossasia#902
@sourcery-ai
Copy link

sourcery-ai bot commented Dec 2, 2025

Reviewer's Guide

Updates Twitter/X social icon usage and implements scroll-based navbar color behavior by introducing a reusable SVG icon, centralized CSS filter rules for different layout regions, and JavaScript scroll handling that toggles navbar state instead of forcing it during load.

Sequence diagram for scroll-based navbar show_content state and X icon color

sequenceDiagram
    actor User
    participant Browser
    participant Document
    participant Window
    participant Nav as overlay_nav
    participant CSS as custom_css

    User->>Browser: Load page
    Browser->>Document: Fire DOMContentLoaded
    Document->>Nav: querySelector overlay_nav
    Document->>Nav: remove show_content
    Nav->>CSS: social-icon in nav uses invert(1) (white at top)

    User->>Window: Scroll page
    Window->>Window: scroll event (> 50)
    Window->>Nav: add show_content
    Nav->>CSS: nav .social-icon uses invert(0) (black when scrolled)

    User->>Window: Scroll back to top
    Window->>Window: scroll event (<= 50)
    Window->>Nav: remove show_content
    Nav->>CSS: nav .social-icon uses invert(1) (white at top)
Loading

File-Level Changes

Change Details Files
Introduce centralized styling for social icons so the X logo switches between white in the navbar at top and black when scrolled, while remaining consistently styled in sidebar and footer.
  • Add .social-icon base class with size, vertical alignment, invert filter and transition
  • Add navbar-specific rules that force white icons when the overlay nav is not scrolled and black icons once .show-content is applied on scroll
  • Add overrides so sidebar social icons are always white and footer-related social icons are always black, independent of scroll or theme state
css/custom.css
Adjust JavaScript initialization so the navbar starts in an unscrolled state and its visual mode is driven purely by scroll position instead of being forced on load.
  • Stop adding the show-content class to nav after loader removal to avoid premature "scrolled" appearance
  • On DOMContentLoaded, remove show-content from .overlay-nav to ensure the header starts in top-of-page mode
  • Add a scroll listener that toggles .show-content on .overlay-nav when window.scrollY crosses a 50px threshold to switch navbar/icon colors
js/scripts.js
Replace font-based Twitter icons with an inline X SVG image and apply the shared social-icon styling across header, footer, and various content sections.
  • Swap usages for X logo in main navigation, footer social lists, call-to-action sections, and Twitter feed block
  • Ensure links and surrounding markup remain unchanged apart from the icon element itself so behavior stays the same
  • Use the same SVG-based icon for both regular and intent/share links to X to keep visuals consistent
index.html
labs/index.html
coc/index.html
licenses/index.html
404.html
500.html
Add the X logo SVG asset used by all updated social links.
  • Introduce img/x-logo.svg as the shared icon source referenced by all updated social links
img/x-logo.svg

Assessment against linked issues

Issue Objective Addressed Explanation
#902 Replace all outdated Twitter bird icons on the FOSSASIA.org site with the new "X" logo asset wherever the Twitter/X link appears (header, footer, share buttons, widgets, etc.).
#902 Ensure the new "X" logo asset is added to the project and styled so that its size, color, and alignment match the existing header/footer design and behave correctly on scroll.

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey there - I've reviewed your changes - here's some feedback:

  • The new DOMContentLoaded handler assumes .overlay-nav always exists; consider null-checking nav before calling classList.remove/add to avoid runtime errors on pages without that element.
  • The CSS for .social-icon relies on multiple !important overrides for different containers; it might be more maintainable to reduce !important usage by tightening selectors or using modifier classes to express the state instead.
  • Now that $('nav').addClass('show-content') is commented out with an inline note, consider either removing it or replacing it with a conditional that respects the scroll logic, so the behavior is encoded in code rather than in comments.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The new `DOMContentLoaded` handler assumes `.overlay-nav` always exists; consider null-checking `nav` before calling `classList.remove`/`add` to avoid runtime errors on pages without that element.
- The CSS for `.social-icon` relies on multiple `!important` overrides for different containers; it might be more maintainable to reduce `!important` usage by tightening selectors or using modifier classes to express the state instead.
- Now that `$('nav').addClass('show-content')` is commented out with an inline note, consider either removing it or replacing it with a conditional that respects the scroll logic, so the behavior is encoded in code rather than in comments.

## Individual Comments

### Comment 1
<location> `js/scripts.js:387-390` </location>
<code_context>
+
+// Force header to start in "not scrolled" state
+document.addEventListener("DOMContentLoaded", function () {
+    const nav = document.querySelector(".overlay-nav");
+    nav.classList.remove("show-content"); // remove black mode at start
+
+    window.addEventListener("scroll", function () {
+        if (window.scrollY > 50) {
+            nav.classList.add("show-content"); // enable black on scroll
</code_context>

<issue_to_address>
**issue (bug_risk):** Guard against missing `.overlay-nav` to avoid runtime errors on pages without that element.

On pages without `.overlay-nav`, `document.querySelector` returns `null`, so `nav.classList.remove` will throw and stop subsequent JS from running. Please add a null check (e.g. `if (!nav) return;`) after the query to make this safe.
</issue_to_address>

### Comment 2
<location> `index.html:881-882` </location>
<code_context>
 								<span class="uppercase">Oh, invite your friends too</span>
 								<a target="_blank" href="https://www.facebook.com/fossasia/"><i class="icon social_facebook icon-large"></i></a>
-								<a target="_blank" href="https://twitter.com/fossasia"><i class="icon social_twitter"></i></a>
+								<a target="_blank" href="https://twitter.com/fossasia"><img src="img/x-logo.svg" alt="X logo" class="social-icon">
+</a>
 								<a target="_blank" href="https://de.linkedin.com/company/fossasia"><i class="icon social_linkedin icon-large"></i></a>
 							</div>
</code_context>

<issue_to_address>
**suggestion:** Clarify the `alt` text to better convey the destination/action rather than just the logo name.

Using just "X logo" as the `alt` text doesn’t convey the purpose of the link to screen reader users. Consider something like "FOSSASIA on X (Twitter)" or, for share buttons, "Share on X (Twitter)" so the action/destination is clear.

Suggested implementation:

```
								<li><a href="https://twitter.com/fossasia" target="_self"><img src="img/x-logo.svg" alt="FOSSASIA on X (Twitter)" class="social-icon">
</a></li>

```

```
								<a target="_blank" href="https://twitter.com/fossasia"><img src="img/x-logo.svg" alt="FOSSASIA on X (Twitter)" class="social-icon">
</a>

```

```
									<img src="img/x-logo.svg" alt="FOSSASIA on X (Twitter) feed" class="social-icon">

```
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

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.

FIX: Update outdated Twitter logo to new "X" branding

1 participant