I've created an image modal that allows users to upload or paste an image. Everything is working well, except for the fact that the buttons on the modal are capturing the focus. This means that pasting only works if the user manually clicks outside the buttons. I want to enable pasting anytime the component or anything inside the component has focus.
<div onPaste="onPaste()">
<button class="__cancel" aria-label="Close" onClick="onClickCancel()">
<button ... upload .../>
</div>
Is there a way to allow the paste action to flow through the buttons?
Since this is an Angular application, below is code that resembles what I am working with:
<div (paste)="onPaste($event)" cdkTrapFocusAutoCapture cdkTrapFocus>
<button class="__cancel" aria-label="Close" (onClick)="onClickCancel()">
<button ... upload .../>
</div>
I have attempted to add the paste method to the buttons, but it seems that they do not fire.
<div (paste)="onPaste($event)" cdkTrapFocusAutoCapture cdkTrapFocus>
<button class="__cancel" aria-label="Close" (onClick)="onClickCancel()" (paste)="onPaste($event)">
<button ... upload (paste)="onPaste($event)".../>
</div>
Thank you