
| Current Path : /var/www/html/rocksensor1/web/core/modules/system/tests/modules/ajax_test/js/ |
Linux ift1.ift-informatik.de 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64 |
| Current File : /var/www/html/rocksensor1/web/core/modules/system/tests/modules/ajax_test/js/focus-ajax.js |
/**
* @file
* For testing FocusFirstCommand.
*/
((Drupal) => {
Drupal.behaviors.focusFirstTest = {
attach() {
// Add data-has-focus attribute to focused elements so tests have a
// selector to wait for before moving to the next test step.
once('focusin', document.body).forEach((element) => {
element.addEventListener('focusin', (e) => {
document
.querySelectorAll('[data-has-focus]')
.forEach((wasFocused) => {
wasFocused.removeAttribute('data-has-focus');
});
e.target.setAttribute('data-has-focus', true);
});
});
},
};
})(Drupal, once);