css-houdini-squircle icon indicating copy to clipboard operation
css-houdini-squircle copied to clipboard

Breaks when using or wrapping in an anchor element

Open ivoilic opened this issue 2 years ago • 2 comments

Applying a squircle fill to an <a> or wrapping another element in one results in nothing appearing

ivoilic avatar Apr 08 '23 05:04 ivoilic

This is a real make-or-break matter. Does anyone have any insight why this happens?

EDIT: This is a security feature. More info here: https://stackoverflow.com/questions/68094490/paintworklet-isnt-working-inside-anchor-tag

kschiffer avatar Feb 12 '24 10:02 kschiffer

My workaround is to wrap the actual squircle in a div, position it absolute to not interfere with the actual content and make it have full width and height:

<!-- 
hard set parent z-index so squircle don't end up beneath other content
 -->
<div className='z-0 relative size-20'>
<!-- 
Set the z-index to negative so it isn't on top of the actual content
 -->
  <div className='squircle absolute left-0 top-0 -z-10 h-full w-full'></div>
  <a className='h-full w-full' href='mailto:###'>
    <!-- Your link content -->
  </a>
</div>

pedroalmeida415 avatar Mar 21 '24 16:03 pedroalmeida415