mirror of
https://github.com/opf/openproject.git
synced 2026-06-14 03:30:14 +00:00
[64472] Focus should return to trigger element on closing attribute help text dialog (#19494)
* Fix focus loss when opening and closing async dialog with keyboard * move methods to the connect and clean code
This commit is contained in:
committed by
GitHub
parent
a89af1dc82
commit
31a3f60e09
@@ -34,13 +34,20 @@ import { TurboHelpers } from '../../turbo/helpers';
|
||||
|
||||
export default class AsyncDialogController extends ApplicationController {
|
||||
connect() {
|
||||
this.element.addEventListener('click', (e) => {
|
||||
e.preventDefault();
|
||||
this.element.addEventListener('click', (event:MouseEvent) => {
|
||||
event.preventDefault();
|
||||
this.triggerTurboStream();
|
||||
});
|
||||
|
||||
this.element.addEventListener('keydown', (event:KeyboardEvent) => {
|
||||
if (event.key === 'Enter' || event.key === ' ') {
|
||||
event.preventDefault();
|
||||
this.triggerTurboStream();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
triggerTurboStream():void {
|
||||
private triggerTurboStream():void {
|
||||
TurboHelpers.showProgressBar();
|
||||
|
||||
void fetch(this.href, {
|
||||
|
||||
Reference in New Issue
Block a user