Is there a way to change parent width when ONLY input is target, not button.
I have tried :focus-within it works perfectly but when I click on button it also changes width because its within parent.
I also tried setting pointer-events: none on button.
What I want: When I first click on button don't resize parent width, only when input is in target, or only when I start typing, whatever.
I also tried with :placeholder-shown
.search-wrapper {
position: relative;
width:40%;
transition: width .5s ease-in;
}
.search-input {
border: 2px solid blue;
width: 100%;
height:40px;
}
.search-button {
position: absolute;
top:50%;
right: 0;
transform: translateY(-50%);
}
/*Make this to work*/
.search-wrapper:focus-within {
width: 60%;
}
<div class="search-wrapper">
<input class="search-input" type="text" placeholder="search ....">
<button class="search-button">
Button
</button>
</div>