Improve Popup Accessibility

This commit is contained in:
copecone committed 2026-04-01 13:12:33 +09:00
1 parent 7b5ba462cb
commit bac135853d
1 file changed
+11 -1
+11 -1
View File
@@ -1,4 +1,4 @@
import { Component, input, output } from '@angular/core';
import { Component, input, output, HostListener } from '@angular/core';
export type PopupPosition = {
top?: string;
@@ -14,6 +14,11 @@ export type PopupVariant = 'glass' | 'solid';
standalone: true,
templateUrl: './popup.html',
styleUrl: './popup.scss',
host: {
'role': 'dialog',
'aria-modal': 'true',
'tabindex': '-1'
}
})
export class PopupComponent {
/**
@@ -32,6 +37,11 @@ export class PopupComponent {
*/
closeRequest = output<void>();
@HostListener('document:keydown.escape')
onKeydownHandler() {
this.onClose();
}
onClose() {
this.closeRequest.emit();
}