I have a scenario like this:
.container {
background: yellow;
padding: 40px;
}
.container:focus-within {
background: red;
}
iframe {
background: white;
}
<div class="container">
<input type="text" placeholder="Input 1">
<iframe srcdoc="<input type='text' placeholder='Input 2'>"></iframe>
</div>
As you can see, when I click on input 1 to type, the container turns red because of the :focus-within
selector. But when I focus input 2 (inside the iframe), it doesn't.
Is it possible to use a CSS selector on .container
for if something inside the iframe is focused? I have control over the CSS inside the iframe as well.