I created a textarea field that expands when pressed and draws out when it is out of focus.
However, if the text field is already in the expanded form, I want it to remain in the expanded form if the user clicks anywhere in the container area (blue area in the fragment).
Here is my CSS for textarea animation
.container {
width: 588px;
background: #E8F5FD;
mix-blend-mode: normal;
opacity: 1.00;
border-radius: 3px;
padding: 10px;
}
textarea {
font-family: "Roboto";
font-style: normal;
font-weight: normal;
width:508px;
height:38px;
font-size: 13px;
line-height: 100%;
opacity: 1.00;
border: 1px solid #C6E7FB;
box-sizing: border-box;
border-radius: 3px;
margin-left: 5px;
transition: all 0.0s ease;
resize: none;
}
textarea:focus {
width: 508px;
height: 82px;
}
<div class = "container">
<textarea> </textarea>
<button
type="button"
className="sendButton"
onClick={this.handleSubmit}>Send</button>
</div>
Run codeHide resultHow can I save a text box in expanded form if the user clicks anywhere in the div container? And let it behave as it is now, if the user clicks somewhere outside the container?
source
share