-
Notifications
You must be signed in to change notification settings - Fork 166
terra-search-field onChange not triggered when the value is set programmatically #2727
Comments
@FloraChenCerner The
For the dictation issue(if you are talking about the macOs dictation accessibility), it seems to work fine. Let me know if i am wrong here. @StephenEsser |
When saying dictation, I refer to the Nuance dictation which is a third party dictation tool we use to dictate medical terms. If the macOS dictation is triggering the auto search, is it because it's not programmatically adding text? If the onChange event can't be triggered in this case, can we have something else triggered to make auto search work? Even clicking the search button doesn't work for us. |
We need design input as to whether dictation should trigger auto search. Clicking the search button should trigger a search and that is a minor bug. |
@mjhenkes Adding text programmatically and clicking search icon does trigger a search. |
@FloraChenCerner Could you point to your project github or provide a reduced case for the issue ?? |
@lokesh-0813 It's really hard to setup the project or provide a reduced case since we are using third party dictation api, and it need to be running in the iOS simulator. I noticed when you add the text programmatically, the 'x' button is shown, whereas in our case that button is not shown |
@FloraChenCerner I tried with terra-search-field downgraded to version 3.0.0 and still was not able to reproduce the issue. Does the search work with keyboard input ? Also could you try dictating via macOS dictation and check if the search call gets triggerred ? If you could help me with how you have implemented search-field in your project, I can get a better idea of what's going on ? Here is an example of what I tried. Click to expand
|
@lokesh-0813 The search does work with keyboard input and we implemented search field just like you did. I'm trying to figure out if the issue is with dictation itself. I will let you know when dictation team make progress |
Flora, I think that the easiest way to find out if dictation is causing the behavior is to not initialize dictation for the search field on your page and give this workflow a try. |
Talked to the dictation team and we found the root cause is we are supposed to listen to an event they fire when text is dictated and added to the field. However even we listen to their event, the callback method they use to trigger the event didn't get called. Dictation team is going to add terra inputs in their test app to see whether and why the terra component is preventing that method being called. |
So we managed to listen to their event and perform the search in the event handler, and update the search field value with the event target value. However this means onChange is not getting called in the search field, which means this method won't get called, which means these lines will never get hit. Is it possible to hit those logic when we only change the value programmatically? |
@FloraChenCerner As I have mentioned earlier, The input used in terra-search-field is a wrapper around native element. It is the default functionality of the native element to not fire onChange event on adding text programmatically. |
@lokesh-0813 I discussed with @dkasper-was-taken and @tbiethman, and I'm suggested to use onInput instead since it will be get fired when value is set programmatically. However terra form elements don't explicitly support it for now. If I use it instead of onChange some internal state won't get updated and so logics won't be hit, so they say the work will be planned and prioritized. Thank you. |
@dkasper-was-taken and @tbiethman Should we consider doing something like this. Here is something related. |
@lokesh-0813 We shouldn't need to do that. If we update the search field to properly handle the onInput callback, I believe this issue will be resolved. |
Bug Report
Description
When we were testing dictation (Nuance dictation) in one of our search field, after the character is added to the field by the dictation, the auto search is not triggered. Clicking on the search button doesn't work either. We believe what happened was terra-search-field onChange/onSearch not triggered when the value is set programmatically.
Steps to Reproduce
Set the value of the search input programmatically and observe the auto search is not triggered.
Click on the search button and observe the search is not triggered
Additional Context / Screenshots
Expected Behavior
We expect onChange/onSearch to be triggered when the search value is set programmatically, which means the auto search and clicking on the search button should trigger the search.
Possible Solution
Environment
@ Mentions
@dkasper-was-taken
The text was updated successfully, but these errors were encountered: