RED-9513 - Enter Key Not Working: Unable to Add Terms to Dictionary

This commit is contained in:
Valentin Mihai 2024-07-04 12:52:26 +03:00
parent ce334dbdeb
commit 01c244aa07
2 changed files with 7 additions and 16 deletions

View File

@ -1,5 +1,5 @@
<button
(click)="!disabled() && action.emit($event)"
(click)="!disabled() && emitAction($event)"
[disabled]="disabled()"
[id]="buttonId()"
[iqserStopPropagation]="action.observed && !_hasRouterLink"

View File

@ -1,15 +1,5 @@
import { NgClass } from '@angular/common';
import {
booleanAttribute,
ChangeDetectionStrategy,
Component,
computed,
EventEmitter,
HostListener,
inject,
input,
Output,
} from '@angular/core';
import { booleanAttribute, ChangeDetectionStrategy, Component, computed, EventEmitter, inject, input, Output } from '@angular/core';
import { MatButtonModule } from '@angular/material/button';
import { MatIconModule } from '@angular/material/icon';
import { RouterLink } from '@angular/router';
@ -44,9 +34,10 @@ export class IconButtonComponent {
});
@Output() readonly action = new EventEmitter<MouseEvent>();
@HostListener('window:keydown.Enter', ['$event'])
preventEnterKey($event: KeyboardEvent) {
$event?.preventDefault();
$event?.stopPropagation();
emitAction($event: MouseEvent) {
const activeElement = document.activeElement as HTMLElement;
if (activeElement.tagName?.toLowerCase() === 'button') {
this.action.emit($event);
}
}
}