I am making a walkthrough tour for a panel, for this walkthrough guide, I need to create a hole on an overlying layer, so the underlying elements will be only clickable from that hole.
I found a way to make it somehow for inside but I also need to prevent from targeting underlying elements outside of that circle.
NOTE: The example below is a simplified version of the React component I'm making, I need to use border-radius for the focus area because the focus area will be a dynamic area and could change from circle to square (and with transition) according to the target element on the next step of the guide.
Any solution based on CSS or JavaScript would be very helpful. (but please don't use jQuery!)
Thank you in advance.
.content{
width: 100%;
height: 100%;
padding: 3rem;
box-sizing: border-box;
}
button{
padding: 1rem;
margin: 1rem;
}
.guide{
width: 9rem;
height: 9rem;
position: absolute;
z-index: 10;
top: 1.7rem;
left: 11.5rem;
border-radius: 9rem;
box-shadow: 0 0 0 1000rem rgba(0,0,0,0.5);
pointer-events: none;
}
<div class="content">
<button>test button</button>
<button>test button</button>
<button>test button</button>
<p>The user should only <br/>able to click on second button</p>
</div>
<div class="guide"></div>