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

Improve Code Organization, Styling Consistency, and Accessibility in CustomFooter Component #284

Open
amrit1004 opened this issue Mar 18, 2025 · 1 comment · May be fixed by #289
Open

Comments

@amrit1004
Copy link

Bug Report 🐛

The previous implementation of the CustomFooter component lacked proper code organization, had inconsistent styling, and missed some accessibility features. The new code introduces TypeScript interfaces, memoization with useMemo, a common styles object, and improved accessibility with aria-label attributes.

Expected Behavior

  • The footer component should use TypeScript interfaces for better type safety.
  • Styles should be consistent and extracted into a reusable object to avoid duplication.
  • Social media links should include aria-label attributes for accessibility.
  • The footer sections should be memoized for performance optimization.
  • The expandable section should remain keyboard accessible on mobile views.

Current Behavior

  • The old code did not use TypeScript interfaces, leading to potential type errors.
  • Styles were duplicated (e.g., Join button styles) and not centralized.
  • Social media links lacked aria-label attributes, reducing accessibility.
  • Footer sections were not memoized, potentially causing unnecessary re-renders.
  • Color usage was inconsistent, and there was no centralized style management.

Possible Solution

  • Add TypeScript interfaces for FooterLink and FooterSection.
  • Extract styles into a styles object to avoid duplication and ensure consistency.
  • Add aria-label attributes to social media links.
  • Use useMemo to memoize the footer sections data.
  • Maintain existing keyboard accessibility for the mobile expandable section.

Steps to Reproduce

  1. Use the old CustomFooter component code in a React project with Ant Design.
  2. Inspect the Join button styles and note the duplicated inline styles.
  3. Check the social media links in the footer and observe the lack of aria-label attributes.
  4. Resize the window to mobile view and verify keyboard accessibility works but note the lack of performance optimization.

Context (Environment)

This issue impacted the maintainability, accessibility, and performance of the footer component. The goal was to enhance code quality, ensure consistent styling, and improve user experience for screen reader users while optimizing performance.

Desktop

  • OS: [e.g. macOS]
  • Browser: [e.g. Chrome, Safari]
  • Version: [e.g. 0.22.15]

Detailed Description

The updated CustomFooter component includes:

  • TypeScript Interfaces: Added FooterLink and FooterSection interfaces for type safety.
  • Common Styles Object: Extracted styles into a styles object to eliminate duplication (e.g., Join button styles) and improve maintainability.
  • Accessibility: Added aria-label attributes to social media links for better screen reader support.
  • Performance: Used useMemo to memoize footerSections and prevent unnecessary re-renders.
  • Styling Consistency: Improved usage of color variables and centralized style definitions.
  • Preserved Features: Maintained responsive design with Ant Design's Grid system and keyboard accessibility for mobile expandable sections.

Possible Implementation

The changes are already implemented in the new code. The solution involves:

  • Defining styles object and reusing it across components.
  • Adding useMemo for footerSections.
  • Including aria-label attributes in social media Link components.
  • Ensuring TypeScript interfaces are applied to the FOOTER_SECTION data.
@amrit1004 amrit1004 linked a pull request Mar 18, 2025 that will close this issue
5 tasks
@amrit1004
Copy link
Author

Hey @DianaLease

I've fixed the issue and added the necessary changes. Please review the PR when you get a chance. Let me know if any improvements are needed.

Thanks!

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 a pull request may close this issue.

1 participant