iOS browsers including Chrome, Safari, and Firefox are unable to properly render Svg clip-path

When implementing svg clip-path in react, it seems to function correctly on Google Chrome and Firefox for both Desktop and Android. However, there are issues with the display on Safari (iOS and Desktop) as well as Google Chrome on iOS.

Here is the code snippet being used:

<svg
        viewBox="0 0 224 224"
        fill="none"
        xmlns="http://www.w3.org/2000/svg"
        ref={svgRef}
        className={classNames("rounded-full", className)}
        style={{ clipPath: "url(#clipPath)", WebkitClipPath: "url(#clipPath)" }}
      >
        <defs>
          <clipPath id="clipPath">
            <path d={path} />
          </clipPath>
        </defs>

        <path d={path} fill={colors.lightGray} className="mix-blend-darken" />
      </svg>

The svg element includes a conic-gradient.

View the functioning result https://i.sstatic.net/snG1l.png

Alternatively, here is the non-working result on iOS and Safari https://i.sstatic.net/qi2ab.png

Answer №1

After much searching, I finally discovered the solution:

I needed to apply the clipPath to a div that contains the svg element. Here is the updated code:

<div className={classNames("rounded-full", className)} style={{ clipPath: "url(#clipPath)" }}>
     <svg viewBox="0 0 224 224" fill="none" xmlns="http://www.w3.org/2000/svg" ref={svgRef}>
       <defs>
         <clipPath id="clipPath">
           <path d={path} />
         </clipPath>
       </defs>

       <path d={path} fill={colors.lightGray} className="mix-blend-darken" />
     </svg>
   </div>

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

"Enhancing webpage dynamics with jQuery: Exploring the

I have a beginner's question regarding my jQuery script. The script I have makes the menu move slightly to the right. My first issue is that the <a> tag seems to be receiving bottom padding, and I am unsure why or how this is happening. My secon ...

Hindered from implementing a linear gradient

The UI team has provided a linear gradient for the button background in the following format: linear-gradient(bottom, #E4E8EA 0%, #E8EBED 50%, #F1F3F4 96.36%, #FFFFFF 100%), linear-gradient(bottom, #E4E8EA 0%, #e8ebed 50%, #F1F3F4 96.36%, #FFFFFF 100%) I ...

Font-family declaration in CSS is unresponsive to button element

I've encountered an issue with changing the font of a button using CSS. Despite including the necessary declaration, the font does not seem to update as expected. After conducting some research on this problem: I came across this post, but unfortuna ...

Steps to import shared CSS using Styled-components

In my project using react, I've implemented styled-components for styling. One requirement is to have a shared loading background. Here is the code snippet of how I defined it: const loadingAnimation = keyframes` 0% { background-position: 95% 95%; } ...

Variety of color palettes within a single style sheet

My theme features various styles, including different color schemes. Currently, I load the default CSS first and then an additional stylesheet with specific colors based on the chosen color scheme. However, this process is causing a delay in my site' ...

How come the font size doesn't transfer from the div element to the table element?

I am experiencing an issue with my document presentation. The document is simple and includes HTML and CSS code as well as some text content. When I render the document, I notice that the table element does not inherit the font size from its parent div, un ...

The menu lacks responsiveness

I'm looking to create a responsive menu on my website where the button that opens the navigation will be hidden in "desktop mode". I came across some information on w3school, but I seem to have made an error. Can you assist me with this, please? Thank ...

Tips for avoiding anchor tag text from being split across two lines when resizing

One issue I am facing is with an anchor tag that displays the name of the logged-in person. The problem arises when resizing the browser window, causing the name to split across two lines. Is there a way to prevent this from happening? ...

Issue with Bootstrap 4 navbar functionality on smaller screens

I'm currently in the process of integrating a navbar that transforms the navbar choices into a dropdown menu on smaller screens (as illustrated in the documentation available here). However, I am encountering an issue where the button responsible for ...

Issue with styling Icon Menu in material-ui

I'm having trouble styling the Icon Menu, even when I try using listStyle or menuStyle. I simply need to adjust the position like this: https://i.sstatic.net/n9l99.png It currently looks like this: https://i.sstatic.net/WeO1J.png Update: Here&apo ...

Analyzing data on iOS with Google Analytics and utilizing Alamofire and cocoapods for

In the past year, I have had no issues working with Google Analytics, but now I am transitioning to Swift. However, I am encountering difficulties importing it using pods. After thorough research, it appears that the issue lies with the requirement of [use ...

Using a subheader in conjunction with a virtual repeater in markdown does not function correctly

Currently, I am utilizing angular 1 along with angular material. I am trying to incorporate md-subheader with multiple md-virtual-repeat-containers within an ng-repeat loop. The source code can be found on this codepen. The issue I am facing is slightly c ...

Creating a dynamic sidebar menu with clickable submenus through jQuery and CSS for a user-friendly experience

<div id="sidebar" class="sidebar"> <div class="slimScrollDiv" style="position: relative; overflow: hidden; width: auto; height: 100%;"> <div data-scrollbar="true" data-height="100%" data-init="true" style="overflow: hidden; width: a ...

How can one efficiently process a JSON array in Swift?

I am new to coding with Swift and I am attempting to send an HTTP request in Swift. Although I have managed to send the request, I am encountering difficulties parsing the response. Despite extensive research, I have not been successful in finding a solut ...

The svg image could not be loaded from an external URL due to a Content Security Policy directive violation stating: "default-src 'none'"

Currently, I am working on creating an SVG that includes an image from an external URL: https://i.stack.imgur.com/4iGwt.jpg: <svg version="1.1" baseProfile="full" width="300" height="86" viewBox="0 0 300 86" preserveAspectRatio="xMinYMin meet" xmlns= ...

merge various CSS styles into a single one

My div has a mix of styles applied to it. <div class="alert alert-secondary login-alert" role="alert">Please contact the administrator to receive credentials!</div> The styles alert and alert-secondary are default styles from bootstrap 4, whi ...

Sending push certificates to APNS using their APIs: A step-by-step guide

Struggling with sending push notifications using APNS push certificate from my server app (Spring Boot Application). Apple provides an overview on how to send push with a certificate here, but there is lacking technical detail on TLS communication (specifi ...

Tips for positioning footer text to the left and right, similar to Google's style

Explore www.google.com for inspiration. You will notice a footer containing links to Advertising, Business, and About on the left side, and Privacy, Settings, Terms, etc. on the right side at the bottom of the page. I am an aspiring developer attempting ...

Ensuring IconButton is perfectly aligned with Text in one straight line

I want to display IconButtons alongside plain text in a single block of text, but the result didn't turn out as I had hoped. Here is what I attempted: JS(ReactJS): <div> <span> <h3>Title</h3> <IconButton className ...

Tips for directing attention to a specific row with an input field in JavaScript

I duplicated a table and added an input field for users to search or focus on a specific row. However, there are two issues: When a user enters a row number, the table displays the wrong row - for example, if the user enters 15, the table shows row number ...