| 344 | if (this.dlg != document.activeElement?.closest('.popup')) | 345 | if (this.dlg != document.activeElement?.closest('.popup')) |
| 345 | return; | 346 | return; |
| 346 | | 347 | |
| 347 | // Check if the current focus is a result control. Only should we apply the compelete action | 348 | // Check if the current focus is a result control. Only should we apply the complete action |
| 348 | const resultControl = document.activeElement?.closest('.result-control'); | 349 | const resultControl = document.activeElement?.closest('.result-control'); |
| 349 | if (!resultControl) | 350 | if (!resultControl) |
| 350 | return; | 351 | return; |
| 351 | | 352 | |
| | 353 | // Check if we are inside an input type text or a textarea field and send on enter is disabled |
| | 354 | const textarea = document.activeElement?.closest('textarea'); |
| | 355 | if (textarea instanceof HTMLTextAreaElement && !shouldSendOnEnter()) |
| | 356 | return; |
| | 357 | const input = document.activeElement?.closest('input[type="text"]'); |
| | 358 | if (input instanceof HTMLInputElement && !shouldSendOnEnter()) |
| | 359 | return; |
| | 360 | |
| 352 | evt.preventDefault(); | 361 | evt.preventDefault(); |
| 353 | evt.stopPropagation(); | 362 | evt.stopPropagation(); |
| 354 | const result = Number(document.activeElement.getAttribute('data-result') ?? this.defaultResult); | 363 | const result = Number(document.activeElement.getAttribute('data-result') ?? this.defaultResult); |