Closed kolbykskk closed 1 year ago
Have you tried focus.native
?
I just tried focus.native
just now, my code still doesn't trigger. I quickly Googled the focus
event, and this came up:
The
focus
event fires when an element has received focus. The main difference between this event andfocusin
is thatfocusin
bubbles whilefocus
does not.
I guess in the polaris-text-field
component's implementation, the focus
event is being attached to an ancestor of the field, and as a result of the fact that focus
doesn't bubble, it never gets triggered. (And I assume this just got missed in QA.)
So I found a workaround using focusin
:
<polaris-text-field
label="Some label"
type="text"
@focusin.native="doSomething()">
</polaris-text-field>
The focus event is not being triggered on the polaris-text-field tag. I replaced that tag with just a simple input and it worked as expected. I also tried a change event on the polaris-text-field and it worked.
I've tried a bunch of things but that's what I have currently.