Shadow on ADD SVGs is built-in.

Created on 18 April 2024, 8 months ago

Problem/Motivation

I have been trying to find where to override the drop shadow on the SVG ADD buttons within CSS but cannot find it.

With our white page background the shadow just looks a bit messy.

The recent addition of the ability to choose the backed edit colour clearly extends to the SVG ADD buttons and that's a super feature but I don't think the module should impose any kind of decorative styling, especially built into the SVGs themselves.

Potential SVG lines

Could it be that it's been built into the SVG itself via the lines which read...

...
  <feFlood flood-opacity="0" result="BackgroundImageFix"></feFlood>
      <feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0"
        result="hardAlpha"></feColorMatrix>
      <feOffset></feOffset>
      <feGaussianBlur stdDeviation="2.5"></feGaussianBlur>
      <feComposite in2="hardAlpha" operator="out"></feComposite>
...
<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_21_2236"></feBlend>
      <feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_21_2236" result="shape"></feBlend>
...

If my theory is correct then I should like to suggest removing all of the this hard-coded blurring and blending.

The full SVG

<svg width="50" height="50" viewBox="0 0 50 50" fill="none" xmlns="http://www.w3.org/2000/svg">
  <g filter="url(#filter0_d_21_2236)">
    <circle cx="25" cy="25" r="20" fill="currentColor"></circle>
  </g>
  <path d="M25 17V33" stroke="white" stroke-width="2" stroke-linecap="round"></path>
  <path d="M33 25L17 25" stroke="white" stroke-width="2" stroke-linecap="round"></path>
  <defs>
    <filter id="filter0_d_21_2236" x="0" y="0" width="50" height="50" filterUnits="userSpaceOnUse"
      color-interpolation-filters="sRGB">
      <feFlood flood-opacity="0" result="BackgroundImageFix"></feFlood>
      <feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0"
        result="hardAlpha"></feColorMatrix>
      <feOffset></feOffset>
      <feGaussianBlur stdDeviation="2.5"></feGaussianBlur>
      <feComposite in2="hardAlpha" operator="out"></feComposite>
      <feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.25 0"></feColorMatrix>
      <feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_21_2236"></feBlend>
      <feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_21_2236" result="shape"></feBlend>
    </filter>
  </defs>
</svg>
Feature request
Status

Active

Version

1.6

Component

Code

Created by

🇬🇧United Kingdom SirClickALot Somerset

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @SirClickALot
  • 🇩🇪Germany a.dmitriiev

    SirClickalot, it would be nice if you would provide steps to reproduce this problem. Please report what browser are you using, its version, what OS and its version as well. At the moment I see no issue with SVG on Safari Version 17.4.1 (19618.1.15.11.14), Chrome Version 124.0.6367.60 (Official Build) (arm64) and Firefox 125.0.1 (64-bit) on MacOS 14.4.1 (23E224)

    The screenshot from each browser are attached.

  • 🇬🇧United Kingdom SirClickALot Somerset

    Sure, here we go...

    The appearance of the Front End Editing (FEE) toggle across my three platforms.

    Windows 11, Chrome Version 123.0.6312.124 (Official Build) (64-bit) with EDITED SVG

    In this screen shot I temporarily removed the filtering from form within the SVG file.
    NO rough edges here confirming that it's all about the SVG content.

    Windows 11, Chrome Version 123.0.6312.124 (Official Build)

    Rough (jagged) edges as per original issue.

    Windows 11, Firefox Developer, 126.0b3

    Rough (jagged) edges as per original issue.

    UBUNTU 22.10, Chrome Version 123.0.6312.124 (Official Build)

    Rough (jagged) edges as on Windows.

    macOS Ventura 13.5

    Nice smooth edges - but macOS appears to dealing with them uniquely.

    Conclusions

    I hope that's fairly conclusive evidence that the only way the filtering inside the SVG itself gives acceptable screen appearance in in macOS.

    HOWEVER, quite apart from all of the above, I really don't it is the right the to 'hard code' the drop shadow into the SVG itself because it makes it much more difficult for the site-build / theme developer to adapt the widget into a theme where they have opted for a no-drop-shadow LAF.

    All other buttons shipped as part of the FEE use box-shadow: rgba(0,0,0,0.16) 0px 1px 4px; in #CSS to achieve the drop shadow which I think is the better (more easily overridable) approach.

    I hope that is all useful stuff!

  • 🇩🇪Germany breidert

    Good points SirClickalot - I agree with your conclusion.

  • 🇩🇪Germany a.dmitriiev

    Unfortunately, it is not so easy to add the shadow to a circle inside SVG. I have added in MR, but the shadow has a gap to circle like 3-4 px.

  • 🇬🇧United Kingdom SirClickALot Somerset

    I don't think we want/need to add the shadow to the SVG do we?
    In fact that is precisely my point...

    I really don't it is the right the to 'hard code' the drop shadow into the SVG.

    Surely this can be done by shaping the HTML element with rounders corners (border-radius) and then adding a box-shadow.

    That way we get the best of both worlds: a default for module but the ability to override in our theme.

  • 🇬🇧United Kingdom SirClickALot Somerset

    This is still a problem on Windows machines.

    I don't understand why the shadow can't be provided via CSS.

    Here's how it's done in the core Cpontextual Links...

    .contextual .trigger {
      width: 32px !important;
      height: 32px !important;
      box-shadow: 0 2px 4px rgba(0, 0, 0, .15);
      border-radius: 50%;
      box-sizing: border-box;
    }

    could this possibly be addressed since it really it rather ugly in Windows and we mustn't forget Windows users - there a lot of them out there.

Production build 0.71.5 2024