Skip to content

Conversation

@adrianschmidt-bot
Copy link
Contributor

@adrianschmidt-bot adrianschmidt-bot commented Jan 31, 2026

Description

This PR addresses issue #3672 by encoding all raw SVG data URIs in SCSS files with proper percent-encoding and normalizing the preamble to use data:image/svg+xml;charset=utf-8.

Problem

Raw/unencoded SVG data URIs can cause rendering issues in some browsers, particularly with special characters like angle brackets (<, >) and spaces. Different browsers may interpret these characters inconsistently.

Solution

  • Percent-encode all SVG content in data URIs (e.g., <%3C, >%3E, spaces → %20)
  • Normalize all preambles to use data:image/svg+xml;charset=utf-8, format

Files Changed

  • src/style/mixins.scss - Close button icon
  • src/components/tab-bar/tab-bar.scss - Tab curve mask images
  • src/design-guidelines/size/examples/size-edge-case.scss - Avatar icons
  • src/components/icon/examples/icon-size-ui.scss - Checkered pattern background
  • src/components/code-editor/code-editor.scss - Error marker and fold marker icons

Fixes #3672

Summary by CodeRabbit

  • New Features

    • Slider component now supports a displaysPercentageColors property to enable percentage color visualization.
  • Style

    • Updated SVG data URL encoding across multiple components for improved standards compliance and charset consistency.
    • Enhanced background sizing in style mixins.

✏️ Tip: You can customize this high-level summary in your review settings.

Replace the need to manually add the `displays-percentage-colors` class
with a proper component prop. This makes the feature discoverable through
TypeScript autocompletion and component documentation.

The class-based approach still works for backward compatibility since the
CSS rules check for the class on the host element.

Fixes Lundalogik#3694
Encode all raw SVG data URIs in SCSS files with proper percent-encoding
and normalize the preamble to use 'data:image/svg+xml;charset=utf-8'.

Raw/unencoded SVG data URIs can cause issues in some browsers, particularly
with special characters like angle brackets and spaces.

Fixes Lundalogik#3672
@adrianschmidt-bot adrianschmidt-bot requested a review from a team as a code owner January 31, 2026 17:30
@coderabbitai
Copy link

coderabbitai bot commented Jan 31, 2026

📝 Walkthrough

Walkthrough

This PR standardizes SVG data URL encoding across multiple SCSS files by replacing plain UTF-8 encoded data URLs with properly percent-encoded equivalents and explicit charset declarations. Additionally, a new boolean prop displaysPercentageColors is introduced to the slider component to enable percentage color display via prop instead of CSS class.

Changes

Cohort / File(s) Summary
SVG Data URL Standardization
src/components/code-editor/code-editor.scss, src/components/icon/examples/icon-size-ui.scss, src/components/tab-bar/tab-bar.scss, src/design-guidelines/size/examples/size-edge-case.scss, src/style/mixins.scss
Updated SVG data URLs from data:image/svg+xml; utf8, format to data:image/svg+xml;charset=utf-8, with proper percent encoding across multiple SCSS files.
Slider Component Enhancement
src/components/slider/slider.tsx
Added new public property displaysPercentageColors: boolean = false; with reflect: true to conditionally apply the displays-percentage-colors CSS class based on prop value.
Slider Example Update
src/components/slider/examples/slider-multiplier-percentage-colors.tsx
Updated example to use the new displaysPercentageColors prop instead of CSS class-based activation for percentage color display.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested labels

maintenance, styling

Suggested reviewers

  • adrianschmidt
  • Kiarokh
  • LucyChyzhova
🚥 Pre-merge checks | ✅ 3 | ❌ 2
❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning The PR objectives describe adding form field examples for issue #2250, but the actual changes are SVG data URI encoding updates and a slider prop addition unrelated to form documentation. The code changes do not implement the form example documentation requested in issue #2250. Add the builtin-field-types-schema.ts and builtin-field-types-form.tsx files to meet the linked issue requirements.
Out of Scope Changes check ⚠️ Warning SVG data URI encoding updates and the new displaysPercentageColors slider prop are out of scope for the form field documentation example requested in issue #2250. Remove unrelated changes or create separate PRs for SVG encoding fixes and slider enhancements. Keep this PR focused on implementing the form field types example per issue #2250.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title describes the main technical change—updating SVG data URIs to use percent-encoding and explicit charset for cross-browser reliability, which aligns with multiple file changes in the changeset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

✨ 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.

@adrianschmidt-bot adrianschmidt-bot changed the title docs(form): add example listing all built-in field types fix(style): percent-encode SVG data URIs for cross-browser reliability Jan 31, 2026
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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/components/slider/examples/slider-multiplier-percentage-colors.tsx (1)

30-57: 🛠️ Refactor suggestion | 🟠 Major

Wrap multiple JSX elements in <Host> instead of array literal.

The render() method returns multiple elements wrapped in an array literal. As per coding guidelines, StencilJS components should use the special <Host> element instead of array literals for returning multiple top-level JSX elements.

♻️ Proposed fix
+import { Component, h, Host, State } from '@stencil/core';
-import { Component, h, State } from '@stencil/core';
     public render() {
-        return [
+        return (
+            <Host>
             <limel-slider
                 displaysPercentageColors={true}
                 label="Slider with percentage colors"
                 unit=" %"
                 value={this.value}
                 factor={this.factor}
                 valuemax={this.maxValue}
                 valuemin={this.minValue}
                 disabled={this.disabled}
                 readonly={this.readonly}
                 onChange={this.changeHandler}
-            />,
+            />
             <limel-example-controls>
                 <limel-switch
                     value={this.disabled}
                     label="Disabled"
                     onChange={this.setDisabled}
                 />
                 <limel-switch
                     value={this.readonly}
                     label="Readonly"
                     onChange={this.setReadonly}
                 />
-            </limel-example-controls>,
-            <limel-example-value value={this.value} />,
-        ];
+            </limel-example-controls>
+            <limel-example-value value={this.value} />
+            </Host>
+        );
     }

As per coding guidelines: "When returning multiple JSX elements from the render method, never wrap them in an array literal. Instead, always wrap them in the special <Host> element."

@adrianschmidt
Copy link
Contributor

@adrianschmidt-bot Please don't re-use PRs like you did here (first opening the PR to solve #2250, then apparently scrapping that and instead using the same PR to fix #3672. It's OK this time, you don't have to redo this PR. But in the future, if you want to scrap your fix for one issue and instead fix something else, please just close the PR and open a new PR for the new fix 🙂

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.

Don't use raw/unencoded SVG data URIs, for a cross-browser reliability

2 participants