We have a control using IgxAutocompleteDirective on a form with other text fields.
When the user selects a form filler field for one of the other text fields, auto-complete throws an exception in this method
handleKeyDown(event) { if (!this.collapsed && !this._composing) { switch (event.key.toLowerCase()) {
because event.key is not defined.
This is causing significant issues in our application and requires us to try to inform our users not to use form filling.
Hello,
Thank you for bringing this describe behavior to our attention. From your description, it seems the exception is occurring because event.key is undefined when a form filler is used with the IgxAutocompleteDirective. This behavior can happen if the form filler triggers events that don't follow the typical keyboard event pattern, leading to the error when the method attempts to use event.key.toLowerCase().
To address this, one approach would be to modify the handleKeyDown method to ensure that it checks for the existence of event.key before trying to access it. Here’s an example of how this could be handled:
handleKeyDown(event) { if (!this.collapsed && !this._composing) { // Safeguard to check if event.key is defined before accessing it if (event.key) { switch (event.key.toLowerCase()) { // Handle different key cases here } } } }
By adding this safeguard, we can prevent the application from throwing an exception when the form filler interacts with the IgxAutocompleteDirective.
If this not helped, to better understand and investigate the describe behavior in your specific context, could you please provide the following:
Additionally, the best approach would be to provide an isolated sample that reproduces the scenario, along with step-by-step instructions. This will allow us to thoroughly examine the behavior and work towards a more robust solution.
We look forward to receiving more information to assist you further and provide a targeted fix.
Regards,
Georgi Anastasov
Entry Level Software Developer
Infragistics
This is YOUR code, not our code. The code that is throwing the exception is in IgxAutocompleteDirective which is owned and maintained by Infragistics.
So you are correct, YOUR code does need to be fixed to handle this scenario.
Please let us know when we can let our customers know this will be fixed by Infragistics.