As you can test in snippet if i focus textarea and click on button no action fires, i have to click one more time
removing focus style all works fine.
what can i do?
thanks
textarea:focus{
height:5rem;
}
<textarea class="dx-texteditor-input" spellcheck="true" tabindex="0" role="textbox" aria-multiline="true"></textarea>
<button onclick="alert('ok');">
test
</button>
2
Answers
the problem is that your button moves when you
onfocus
thetextarea
, that’s why the button wont be clicked.to fix that use the code below:
In short, the UI Events specification explains a
click
for pointer devices as follows:In you example we press down on the button, the button moves, and we release elsewhere (not on the button). We don’t fulfill the conditions for a
click
event to be dispatched!Ideally, UI elements shouldn’t move during interactions. And, there is no need to resize the textarea automatically on focus; the user can already resize it to their liking by default.
Should you want to resize it regardless, simply position the button independently of the textarea, e.g.:
Or delay the change in textarea’s height to a reasonable amount. Example via CSS: