penpot / penpot-plugins

Repository for developing and running Penpot plugins with examples and libraries.
Mozilla Public License 2.0
18 stars 2 forks source link

Missing chevron icon in the select input #128

Closed Belar closed 1 month ago

Belar commented 1 month ago

Hi, I encountered an issue with the select when using it in a plugin.

Issue:

Select's chevron icon is missing when used in a plugin with the plugin-styles package.

Reproduction steps:

  1. Create a plugin
  2. Setup plugin styles https://penpot-docs-plugins.pages.dev/technical-guide/plugins/create-a-plugin/#plugin-styles
  3. Add a select
    <div class="form-group">
    <label class="select-label-hidden" for="select-1">Which is your favourite animal?</label>
    <select class="select" id="select-1">
    <option value="1">Quokka</option>
    <option value="2">Rabbit</option>
    <option value="3">Goat</option>
    <option value="4">Capybara</option>
    </select>
    </div>
  4. Open the plugin in the Penpot editor.

Expected behaviour:

The chevron icon should be visible in the select input.

Potential fix:

In the build script for plugin-styles, 'text' loader is handling the processing of SVGs https://github.com/penpot/penpot-plugins/blob/cc6b9e58945bed9e00be61f219682a8ad331d3d7/libs/plugins-styles/src/lib/components/select.css#L3-L5 https://github.com/penpot/penpot-plugins/blob/cc6b9e58945bed9e00be61f219682a8ad331d3d7/tools/scripts/build-css.mjs#L17-L19 and builds them to a url with plain text base64.

Changing the loader to 'dataurl’ fixes the issue, it builds to a media url.

juanfran commented 1 month ago

Thanks! You were right about the fix