Skip to content

[Feature]: Add Glassmorphism Effect Option #79#107

Open
shreyashpatel5506 wants to merge 6 commits intoprem-k-r:mainfrom
shreyashpatel5506:main
Open

[Feature]: Add Glassmorphism Effect Option #79#107
shreyashpatel5506 wants to merge 6 commits intoprem-k-r:mainfrom
shreyashpatel5506:main

Conversation

@shreyashpatel5506
Copy link

@shreyashpatel5506 shreyashpatel5506 commented Dec 20, 2025

  • l10n(ar): Update theme options translations for light, dark, and system modes

  • l10n(ar): Add footer toast translations for new tab page

  • RTL and changelog

📌 Description

🎨 Visual Changes (Screenshots / Videos)

🔗 Related Issues

  • Closes #<issue_number>
  • Related to #<issue_number>

✅ Checklist

  • I have read and followed the Contributing Guidelines.
  • My code follows the project's coding style and conventions.
  • I have tested my changes thoroughly to ensure expected behavior.
  • I have verified compatibility across Chrome and Firefox (additional browsers if applicable).
  • I have attached relevant visual evidence (screenshots/videos) if applicable.
  • I have updated the CHANGELOG.md under the appropriate categories with all my changes in this PR.

Summary by CodeRabbit (updated)

  • New Features

    • Adds Glassmorphism UI option: toggle to enable/disable frosted-glass effects and a draggable blur-intensity slider with live preview and persisted settings.
    • Exposes a public API window.glassmorphism with methods setEnabled(enabled) and setBlur(px).
    • Loads the new feature by including scripts/glassmorphism.js in index.html (deferred).
  • Localization & RTL

    • Adds Arabic translations and RTL adjustments for theme options (light, dark, system) and footer toasts on the new tab page.
    • Adds four new translation keys for Glassmorphism text (glassmorphismText, glassmorphismInfo, glassBlurTitle, glassBlurDesc) to locales and the runtime translation map.
    • Note: locales/en.js contains duplicated insertion of the same four keys.
  • Styling

    • Introduces CSS variables and rules for glass blur, saturation, alpha and max blur; applies backdrop-filter and overlay tinting when glass is enabled.
    • Adds disabled-state styling for controls and minor slider opacity rules.
    • Some Glassmorphism-related CSS blocks are duplicated in the stylesheet.
  • Behavior & Accessibility

    • scripts/glassmorphism.js implements mouse/touch drag and click handling, clamps blur to a MAX_BLUR CSS fallback, updates ARIA attributes and UI elements, and persists state to localStorage.
    • The PR description contains placeholders for a concise description, visual changes, and related issue references.
  • Changelog & Checklist

    • CHANGELOG.md updated.
    • Contributor asserts they followed contributing guidelines, coding style, tested across Chrome/Firefox, attached visual evidence if applicable, and completed the checklist. Issue/PR references to close or relate remain as placeholders.
  • Notes for reviewers

    • Duplicate translation keys in locales/en.js and duplicated CSS blocks should be cleaned up.
    • Verify RTL adjustments and Arabic strings in-context.
    • Confirm ARIA attribute updates and focus/keyboard behavior where applicable.

@coderabbitai
Copy link

coderabbitai bot commented Dec 20, 2025

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Adds a Glassmorphism feature: new scripts/glassmorphism.js module (exposed as window.glassmorphism), CSS variables and backdrop-filter rules in style.css, four new translation keys in locales/en.js and scripts/languages.js, and inclusion of the script in index.html. Duplications of locale keys and CSS blocks are present.

Changes

Cohort / File(s) Summary
HTML
index.html
Includes new script scripts/glassmorphism.js (deferred).
Feature JS
scripts/glassmorphism.js
New module: manages enable/disable, adjustable blur, pointer/touch drag and click handling, persists glassEnabled/glassBlur to localStorage, initializes state, updates ARIA/UI, exposes window.glassmorphism API (setEnabled, setBlur).
i18n / Language
locales/en.js, scripts/languages.js
Adds translation keys glassmorphismText, glassmorphismInfo, glassBlurTitle, glassBlurDesc; keys are duplicated in locales/en.js. scripts/languages.js updated to include these keys in translation mapping.
Styling
style.css
Adds CSS variables (--glass-blur, --glass-saturation, --glass-alpha, --glass-max-blur), html.glass-enabled backdrop-filter and tint rules, disabled-state styles for controls; glass-related blocks appear duplicated in stylesheet.

Sequence Diagram(s)

sequenceDiagram
  participant User as User
  participant DOM as DOM / Controls
  participant JS as scripts/glassmorphism.js
  participant Storage as localStorage
  participant CSS as Browser / CSS vars

  User->>DOM: click toggle or drag slider
  DOM->>JS: event (click / pointer / touch)
  JS->>CSS: set --glass-blur, add/remove `glass-enabled` class
  JS->>Storage: persist `glassEnabled` / `glassBlur`
  JS-->>DOM: update checkbox, slider UI, ARIA attributes
  CSS-->>DOM: browser applies backdrop-filter and visual updates
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested labels

i18n/l10n

Suggested reviewers

  • prem-k-r
🚥 Pre-merge checks | ✅ 1 | ❌ 2
❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description contains placeholder text unrelated to the actual Glassmorphism feature changes (mentioning Arabic translations and RTL adjustments), missing a clear explanation of the new feature and its implementation details. Update the description section to explain the Glassmorphism feature, add relevant screenshots showing the blur effect and toggle, link issue #79, and ensure the description aligns with actual changes instead of containing unrelated placeholders.
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title '[Feature]: Add Glassmorphism Effect Option #79' directly matches the main changes, which involve adding a comprehensive Glassmorphism feature with new CSS variables, JavaScript module, and localization support.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


No actionable comments were generated in the recent review. 🎉


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.

Copy link

@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: 1

🧹 Nitpick comments (2)
style.css (1)

37-41: CSS glass variables and selectors look coherent; only minor cascade nuance

The new --glass-* variables and body.glass-enabled … rules line up well with the JS feature and provide a clear tuning surface. One nuance: body[data-bg="wallpaper"] .bgLightTint:not(.notTargeted) has higher specificity than body.glass-enabled:not(.dark-theme) .bgLightTint, so under wallpaper backgrounds the wallpaper tint will still dominate and your --glass-alpha-based tint won’t fully take over. If you want glass tint to win there as well, consider slightly increasing selector specificity (e.g., adding the same attribute selector) or restructuring those rules. You might also optionally wrap the dark alpha expression in clamp() to avoid going negative if --glass-alpha is ever tuned below 0.12.

Also applies to: 1876-1900

index.html (1)

1704-1746: Glassmorphism controls are wired correctly; consider gating slider by toggle state

The new glassControl + glassBlurControl blocks are consistent with the existing opacity UI and align with your i18n keys and JS selectors (glassCheckbox, glassSlider, glassBlurLevel). One optional UX improvement: right now the blur slider is always usable (when wallpaper is active) even if Glassmorphism is turned off; you may want to visually disable or hide #glassBlurControl unless #glassCheckbox is checked so users don’t wonder why changing blur has no visible effect while the feature is off.

📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4a3ee0a and 86bad03.

📒 Files selected for processing (5)
  • index.html (2 hunks)
  • locales/en.js (1 hunks)
  • scripts/glassmorphism.js (1 hunks)
  • scripts/languages.js (1 hunks)
  • style.css (2 hunks)
🔇 Additional comments (3)
scripts/languages.js (1)

224-235: Glassmorphism translation keys correctly wired into language pipeline

The four new keys are cleanly added to translationMap and will localize the new UI via the existing applyTranslations flow, with safe fallback to English where locales aren’t yet updated.

locales/en.js (1)

160-165: New English strings for Glassmorphism are well-scoped and consistent

The four added keys accurately describe the toggle and blur slider behavior and integrate cleanly into the existing en locale object, with no structural or duplication issues visible in this final state.

index.html (1)

21-32: Script inclusion order for glassmorphism.js is appropriate

Loading scripts/glassmorphism.js with defer alongside the other feature scripts is fine; it will see the full DOM and doesn’t introduce ordering conflicts with the existing modules in this layout.

Copy link

@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: 1

♻️ Duplicate comments (4)
scripts/glassmorphism.js (4)

22-37: Class target mismatch still present — CSS expects body.glass-enabled

This issue was flagged in a previous review and remains unaddressed. The class is added to document.documentElement (<html>), but the CSS selectors in style.css use body.glass-enabled, so the glass styling will never apply.


69-70: Stored blur of 0 is coerced to default 8

This was flagged in a previous review. Using || 8 means a user-saved value of 0 is overwritten with 8 on reload.


13-20: Add null checks inside setGlassBlur to prevent runtime errors.

glassSlider and glassBlurLevel are accessed without guards. If either element is missing, this function will throw.

Proposed defensive fix
 function setGlassBlur(px) {
     const clamped = Math.max(0, Math.min(MAX_BLUR, Math.round(px)));
     const percent = (clamped / MAX_BLUR) * 100;
-    glassSlider.style.width = `${percent}%`;
-    glassBlurLevel.textContent = `${clamped}px`;
+    if (glassSlider) glassSlider.style.width = `${percent}%`;
+    if (glassBlurLevel) glassBlurLevel.textContent = `${clamped}px`;
     document.documentElement.style.setProperty('--glass-blur', `${clamped}px`);
     localStorage.setItem('glassBlur', clamped);
 }

40-48: handleGlassDrag will throw if glassBar is null.

Add a guard at the start of this function to avoid errors when the element is missing.

Proposed fix
 function handleGlassDrag(e) {
+    if (!glassBar) return;
     const clientX = e.type.startsWith("touch") ? e.touches[0].clientX : e.clientX;
     const rect = glassBar.getBoundingClientRect();
     // ...
 }
📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 86bad03 and 4c4096f.

📒 Files selected for processing (2)
  • scripts/glassmorphism.js (1 hunks)
  • style.css (2 hunks)
🔇 Additional comments (3)
style.css (2)

37-41: LGTM - Well-structured glassmorphism CSS variables.

The glass effect variables are appropriately scoped and have sensible defaults. The --glass-max-blur: 30px provides a good ceiling for the effect.


1876-1912: Glass styling looks correct, pending JS fix.

The CSS implementation is sound — backdrop-filter with blur/saturate, theme-adaptive background tints, and proper disabled/aria states. However, these styles depend on body.glass-enabled which requires the JS fix flagged in the past review (currently the class is added to <html> instead of <body>).

Once that's addressed, this styling will work as intended.

scripts/glassmorphism.js (1)

93-96: LGTM — Minimal public API exposure.

Exposing setEnabled and setBlur on window.glassmorphism is a clean pattern for allowing other scripts to control the feature programmatically.

Copy link
Owner

@prem-k-r prem-k-r left a comment

Choose a reason for hiding this comment

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

Hi @shreyashpatel5506,
I am not noticing any changes when toggling the option on or off. Could you please check this again?

Copy link
Author

@shreyashpatel5506 shreyashpatel5506 left a comment

Choose a reason for hiding this comment

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

solved

Copy link

@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: 1

🧹 Nitpick comments (1)
style.css (1)

1910-1919: Refactor duplicated disabled state styling.

The disabled state styling is identical for both .opacityBarControl.disabled and #glassBlurControl.disabled. Consider combining them to improve maintainability:

🔎 Suggested refactor
-/* Disabled state for controls (used when glass is off) */
-.opacityBarControl.disabled {
-	opacity: 0.55;
-	pointer-events: none;
-	filter: grayscale(0.18);
-}
-#glassBlurControl.disabled {
-	opacity: 0.55;
-	pointer-events: none;
-	filter: grayscale(0.18);
-}
+/* Disabled state for controls (used when glass is off) */
+.opacityBarControl.disabled,
+#glassBlurControl.disabled {
+	opacity: 0.55;
+	pointer-events: none;
+	filter: grayscale(0.18);
+}

Additionally, note that combining opacity: 0.55 with grayscale(0.18) may reduce visibility for users with visual impairments. Consider testing with accessibility tools.

📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4c4096f and eff0107.

📒 Files selected for processing (2)
  • scripts/glassmorphism.js (1 hunks)
  • style.css (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • scripts/glassmorphism.js
🔇 Additional comments (4)
style.css (4)

37-42: LGTM! Well-defined Glassmorphism variables.

The CSS variables are clearly named and have sensible default values. Starting with --glass-blur: 0px ensures the effect is disabled by default until explicitly activated.


1876-1890: Consider using existing motion variables and note performance implications.

The backdrop-filter implementation looks correct with proper vendor prefixes and gating behind html.glass-enabled. However:

  1. The transition uses hardcoded 200ms ease instead of the existing motion variables (--md-motion-ease, etc.) defined at lines 145-149.
  2. Applying backdrop-filter to multiple elements simultaneously can be performance-intensive on lower-end devices.

Consider testing on mobile/low-power devices and potentially using the existing motion timing variables for consistency.


1892-1898: Good theme-aware background colors, with one minor edge case.

The implementation correctly applies different background colors for light and dark themes when glass mode is enabled. The dark theme's calc(var(--glass-alpha) - 0.12) is appropriate for the default value (0.6 - 0.12 = 0.48).

Note: If --glass-alpha is ever set below 0.12 via JavaScript, this calc could produce a negative value. Consider adding a max(0, ...) wrapper if external modification is possible.


1922-1924: LGTM! Proper use of ARIA attribute for disabled state.

This helper rule correctly uses the aria-disabled attribute to visually indicate the disabled state of the slider, which is good for accessibility.

Copy link

@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: 1

🧹 Nitpick comments (2)
style.css (2)

1929-1938: Consider combining identical disabled state rules.

Both .opacityBarControl.disabled and #glassBlurControl.disabled share identical styles. These can be combined for better maintainability.

🔎 Proposed fix
-/* Disabled state for controls (used when glass is off) */
-.opacityBarControl.disabled {
-	opacity: 0.55;
-	pointer-events: none;
-	filter: grayscale(0.18);
-}
-#glassBlurControl.disabled {
-	opacity: 0.55;
-	pointer-events: none;
-	filter: grayscale(0.18);
-}
+/* Disabled state for controls (used when glass is off) */
+.opacityBarControl.disabled,
+#glassBlurControl.disabled {
+	opacity: 0.55;
+	pointer-events: none;
+	filter: grayscale(0.18);
+}

1876-1890: Implementation is correct; browser support is mature.

As of September 2024, backdrop-filter works across the latest devices and browser versions. The backdrop-filter rules are properly scoped to html.glass-enabled with appropriate -webkit- prefix for Safari. The 200ms transition provides a smooth experience.

Consider adding a @media (prefers-reduced-motion: reduce) query to disable or reduce the transition for users with vestibular motion sensitivities, which is a standard accessibility best practice.

📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between eff0107 and 2d95b87.

📒 Files selected for processing (1)
  • style.css (2 hunks)
🔇 Additional comments (1)
style.css (1)

37-41: LGTM!

Well-organized CSS custom properties for the Glassmorphism feature with sensible defaults. The naming convention follows the existing pattern in the codebase.

Copy link

@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

♻️ Duplicate comments (1)
style.css (1)

1900-1918: Remove duplicate CSS rules (previously flagged).

This entire block duplicates rules already defined above:

  • Lines 1906-1918 duplicate the dark theme background colors from lines 1896-1898
  • The selectors .bgLightTint, .searchbar, .tiles, .lrectangle, .modal-content, .ai-modal-content are already covered by the :not(.dark-theme) and .dark-theme selectors at lines 1892-1898

This duplication increases file size and creates maintenance overhead when only one block gets updated.

🔎 Proposed fix

Remove the duplicate block entirely:

-/* =========================
-   Glassmorphism backgrounds
-   (applied only when enabled)
-========================= */
-
-
-html.dark-theme.glass-enabled .bgLightTint,
-html.dark-theme.glass-enabled .searchbar,
-html.dark-theme.glass-enabled .tiles,
-html.dark-theme.glass-enabled .lrectangle,
-html.dark-theme.glass-enabled .modal-content,
-html.dark-theme.glass-enabled .ai-modal-content {
-    background-color: rgba(
-        0,
-        0,
-        0,
-        calc(var(--glass-alpha) - 0.12)
-    );
-}
-

Note: This issue was previously identified in past reviews but remains unresolved.

🧹 Nitpick comments (1)
style.css (1)

1921-1936: Consider combining duplicate disabled state rules.

The disabled state styling is well-implemented with appropriate visual feedback (reduced opacity, grayscale filter, and disabled interactions). However, .opacityBarControl.disabled and #glassBlurControl.disabled share identical properties.

🔎 Optional refactor to reduce duplication
-/* Disabled state for controls (used when glass is off) */
-.opacityBarControl.disabled {
-	opacity: 0.55;
-	pointer-events: none;
-	filter: grayscale(0.18);
-}
-#glassBlurControl.disabled {
-	opacity: 0.55;
-	pointer-events: none;
-	filter: grayscale(0.18);
-}
+/* Disabled state for controls (used when glass is off) */
+.opacityBarControl.disabled,
+#glassBlurControl.disabled {
+	opacity: 0.55;
+	pointer-events: none;
+	filter: grayscale(0.18);
+}
📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2d95b87 and 307e863.

📒 Files selected for processing (1)
  • style.css (2 hunks)
🔇 Additional comments (3)
style.css (3)

37-41: LGTM! Well-structured Glassmorphism variables.

The CSS variables are properly scoped to :root with sensible default values. The --glass-blur: 0px default ensures no blur is applied until the feature is enabled, and the other parameters (saturation, alpha, max-blur) provide reasonable starting points for the glass effect.


1876-1890: LGTM! Properly scoped backdrop-filter rules.

The backdrop-filter is correctly scoped to html.glass-enabled and applies to all relevant UI elements. The inclusion of both -webkit-backdrop-filter and standard backdrop-filter ensures cross-browser compatibility, and the 200ms transition provides smooth visual feedback when toggling the effect.


1892-1898: LGTM! Theme-aware glass backgrounds.

The background colors are properly scoped and distinguish between light and dark themes. The alpha reduction of 0.12 for dark theme (calc(var(--glass-alpha) - 0.12)) is a good touch to maintain readability with darker backgrounds.

@shreyashpatel5506
Copy link
Author

shreyashpatel5506 commented Dec 21, 2025

Hi @shreyashpatel5506, I am not noticing any changes when toggling the option on or off. Could you please check this again?

Please check, I've updated

@prem-k-r prem-k-r added enhancement New feature or request ui/ux labels Dec 21, 2025
Copy link
Collaborator

@itz-rj-here itz-rj-here left a comment

Choose a reason for hiding this comment

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

I believe it needs more changes. There are so many major flows.

@shreyashpatel5506
Copy link
Author

@itz-rj-here you want to work on this ?

@itz-rj-here
Copy link
Collaborator

@itz-rj-here you want to work on this ?

I am too busy. Somehow got free time today. I just review when i think i have some free time.
Furthermore, I will be free maybe after a year. 🥲
Sorry bud.

@prem-k-r prem-k-r added on-hold Blocked by another PR or pending feature. Will resume once dependency is resolved. changes-requested Review feedback provided. Updates are required before this can be merged. labels Jan 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changes-requested Review feedback provided. Updates are required before this can be merged. enhancement New feature or request on-hold Blocked by another PR or pending feature. Will resume once dependency is resolved. ui/ux

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants