Skip to content

fix: a11y contrast issues#3722

Merged
mattinannt merged 2 commits intoformbricks:mainfrom
jonas-hoebenreich:a11y
Oct 14, 2024
Merged

fix: a11y contrast issues#3722
mattinannt merged 2 commits intoformbricks:mainfrom
jonas-hoebenreich:a11y

Conversation

@jonas-hoebenreich
Copy link
Contributor

@jonas-hoebenreich jonas-hoebenreich commented Oct 14, 2024

What does this PR do?

Fixes #3691 & #3689

How should this be tested?

  • check contrast of "Powered By" and Footer text

Checklist

Required

  • Filled out the "How to test" section in this PR
  • Read How we Code at Formbricks
  • Self-reviewed my own code
  • Commented on my code in hard-to-understand bits
  • Ran pnpm build
  • Checked for warnings, there are none
  • Removed all console.logs
  • Merged the latest changes from main onto my branch with git pull origin main
  • My changes don't cause any responsiveness issues
  • First PR at Formbricks? Please sign the CLA! Without it we wont be able to merge it 🙏

Appreciated

  • If a UI change was made: Added a screen recording or screenshots to this PR
  • Updated the Formbricks Docs if changes were necessary

Summary by CodeRabbit

  • New Features

    • Updated styling for the Legal Footer to enhance visibility with a new text color.
    • Improved scrollbar styling for a more consistent user experience across browsers.
  • Bug Fixes

    • Retained conditional rendering logic for the Legal Footer to ensure proper display based on prop values.
  • Style

    • Adjusted CSS variable definitions for a refreshed color scheme.

@vercel
Copy link

vercel bot commented Oct 14, 2024

@jonas-hoebenreich is attempting to deploy a commit to the formbricks Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 14, 2024

Walkthrough

The changes primarily involve updates to the LegalFooter.tsx component and the global CSS styles. The footer's text color class has been adjusted for improved contrast, while the CSS variable for text color has also been modified. The conditional rendering logic in the footer remains unchanged, ensuring consistent functionality. Additionally, the global CSS file has seen updates to scrollbar styling and variable definitions.

Changes

File Path Change Summary
apps/web/app/s/[surveyId]/components/LegalFooter.tsx Updated text color class from text-slate-400 to text-slate-500. Conditional rendering logic remains unchanged.
packages/surveys/src/styles/global.css Changed --fb-signature-text-color variable from var(--slate-400) to var(--slate-500). Adjusted scrollbar styles and formatting.

Assessment against linked issues

Objective Addressed Explanation
Ensure sufficient color contrast for footer text (3691)
Ensure sufficient color contrast for "Powered by" text (3691) No changes were made to the "Powered by" text color.

Possibly related issues

Possibly related PRs

  • fix: missing footer #3253: This PR modifies the LegalFooter.tsx component, which is directly related to the main PR's changes in the same file, focusing on the structure and styling of the footer component.

Suggested reviewers

  • gupta-piyush19

Poem

🐇 In the footer where colors play,
A brighter hue has come to stay.
With contrast sharp, it shines so bright,
A legal dance in the soft moonlight.
Hopping high with joy and cheer,
Our text now sings, "We’re bright and clear!" 🌟


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 9f242a3 and 2402c67.

📒 Files selected for processing (1)
  • apps/web/app/s/[surveyId]/components/LegalFooter.tsx (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/web/app/s/[surveyId]/components/LegalFooter.tsx

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions github-actions bot added bug Something isn't working 🕹️ 50 points 🕹️ oss.gg Community issue via oss.gg labels Oct 14, 2024
@github-actions
Copy link
Contributor

github-actions bot commented Oct 14, 2024

Thank you for following the naming conventions for pull request titles! 🙏

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: 0

🧹 Outside diff range and nitpick comments (2)
apps/web/app/s/[surveyId]/components/LegalFooter.tsx (2)

Line range hint 23-25: Improve accessibility for keyboard and screen reader users.

While the color contrast has been addressed, there are a few more accessibility improvements we can make:

  1. Remove tabIndex={-1} from all links. This attribute prevents users from focusing on these links using the keyboard, which hinders accessibility.

  2. Add descriptive aria-label attributes to the links to provide more context for screen reader users.

  3. Consider adding a role="contentinfo" to the main div to semantically identify it as a footer.

Here's a suggested implementation for one of the links (apply similar changes to others):

-          <Link href={IMPRINT_URL} target="_blank" className="hover:underline" tabIndex={-1}>
+          <Link href={IMPRINT_URL} target="_blank" className="hover:underline" aria-label="View Imprint in a new tab">
             Imprint
           </Link>

And for the main div:

-    <div className="absolute bottom-0 z-[1500] h-10 w-full">
+    <div className="absolute bottom-0 z-[1500] h-10 w-full" role="contentinfo">

Also applies to: 29-31, 36-41


Line range hint 24-24: Consider implementing internationalization (i18n).

The component currently uses hardcoded English text for the links ("Imprint", "Privacy Policy", "Report Survey"). To improve the component's flexibility and support multiple languages, consider implementing internationalization.

Here's a basic example of how you might implement this using a hypothetical useTranslation hook:

+import { useTranslation } from 'your-i18n-library';

 export const LegalFooter = ({
   IMPRINT_URL,
   PRIVACY_URL,
   IS_FORMBRICKS_CLOUD,
   surveyUrl,
 }: LegalFooterProps) => {
+  const { t } = useTranslation();
   if (!IMPRINT_URL && !PRIVACY_URL && !IS_FORMBRICKS_CLOUD) return null;

   return (
     // ...
-            Imprint
+            {t('imprint')}
     // ...
-            Privacy Policy
+            {t('privacyPolicy')}
     // ...
-            Report Survey
+            {t('reportSurvey')}
     // ...
   );
 };

This change would allow for easy translation of the link text into multiple languages, improving the component's global usability.

Also applies to: 30-30, 39-39

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 9bc5fab and 9f242a3.

📒 Files selected for processing (2)
  • apps/web/app/s/[surveyId]/components/LegalFooter.tsx (1 hunks)
  • packages/surveys/src/styles/global.css (2 hunks)
🧰 Additional context used
🔇 Additional comments (4)
apps/web/app/s/[surveyId]/components/LegalFooter.tsx (1)

20-20: Improved color contrast, but verification needed.

The change from text-slate-400 to text-slate-500 is a step in the right direction to address the accessibility concerns mentioned in the PR objectives. This modification likely increases the contrast ratio, which is crucial for improving readability.

However, to ensure full compliance with WCAG 2 AA standards, we need to verify that the new contrast ratio meets or exceeds the minimum requirement of 4.5:1.

To verify the contrast ratio:

  1. Determine the exact color values for text-slate-500 and the background color.
  2. Use a contrast checker tool (like WebAIM's Contrast Checker) to calculate the ratio.
  3. Document the results in a comment for future reference.

Here's a script to help retrieve the color values:

After running this script, please manually check the contrast ratio using a contrast checker tool and document the results.

packages/surveys/src/styles/global.css (3)

78-78: Approve the color change for improved contrast.

The change from var(--slate-400) to var(--slate-500) for --fb-signature-text-color is a step in the right direction to address the accessibility contrast issues mentioned in the PR objectives and issue #3691.

To ensure this change meets the WCAG 2 AA minimum contrast ratio of 4.5:1, please verify the contrast ratio using a tool like WebAIM's Contrast Checker (https://webaim.org/resources/contrastchecker/). Input the RGB values for --slate-500 (100, 116, 139) and the background color to confirm the new contrast ratio.


111-116: Approve formatting changes and scrollbar adjustments.

The formatting changes in the .fb-no-scrollbar class improve code readability. The explicit scrollbar-color setting ensures consistency across browsers.

Please verify the visual impact of scrollbar-width: thin on Firefox browsers to ensure it aligns with the intended design. You can use Firefox's responsive design mode or a physical Firefox browser for testing.

Also applies to: 123-123, 127-127


Line range hint 1-127: Summary: Accessibility improvements and code readability enhancements.

The changes in this file align well with the PR objectives of addressing accessibility contrast issues. The adjustment to --fb-signature-text-color should improve contrast, potentially resolving the issues mentioned in #3691 and #3689. The formatting changes in the .fb-no-scrollbar class enhance code readability without altering core functionality.

To ensure full compliance with accessibility standards:

  1. Verify the new contrast ratio meets WCAG 2 AA requirements (4.5:1) using a contrast checker tool.
  2. Test the visual impact of scrollbar-width: thin on Firefox browsers.

Overall, these changes represent a positive step towards improving the application's accessibility and maintainability.

@jonas-hoebenreich jonas-hoebenreich changed the title Fix: a11y contrast issues fix: a11y contrast issues Oct 14, 2024
Copy link
Member

@mattinannt mattinannt left a comment

Choose a reason for hiding this comment

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

@jonas-hoebenreich thanks for the a11y fix :-)

@mattinannt mattinannt added this pull request to the merge queue Oct 14, 2024
Merged via the queue into formbricks:main with commit 9bf7440 Oct 14, 2024
@oss-gg
Copy link

oss-gg bot commented Oct 14, 2024

Awarding jonas-hoebenreich: 50 points 🕹️ Well done! Check out your new contribution on oss.gg/jonas-hoebenreich

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

Labels

bug Something isn't working 🕹️ oss.gg Community issue via oss.gg 🕹️ 50 points

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] "Powered by" insufficient color contrast

2 participants