Verified Commit 6ee816a9 authored by Bogdan Bodnar's avatar Bogdan Bodnar Committed by Martin Matějek

Fix document.activeElement behavior on Safari and Firefox (MacOS).

parent 4d58a361
// TODO separete reasonable part for dynamic js
// TODO separate reasonable part for dynamic js
Foris.initNetbootRecordsForms = () => {
$(".record-form").submit((e) => {
......@@ -39,7 +39,7 @@ Foris.initNetbootRecordsForms = () => {
break;
}
});
}
};
Foris.addWsHanlder("netboot", (msg) => {
switch(msg.action) {
......@@ -54,4 +54,12 @@ Foris.addWsHanlder("netboot", (msg) => {
$(document).ready(function() {
Foris.initNetbootRecordsForms();
Foris.loadNetbootList();
// Workaround to get document.activeElement worked similar on Safari and Firefox on MacOS
// https://zellwk.com/blog/inconsistent-button-behavior/
document.addEventListener('click', function (event) {
if (event.target.matches('button')) {
event.target.focus()
}
})
});
......@@ -223,6 +223,14 @@
Foris.loadSubordinatesList();
Foris.afterAjaxUpdateFunctions.push(Foris.suboridnatesOverrideEditClose);
Foris.afterAjaxUpdateFunctions.push(Foris.overrideSubordinatesEditButton);
// Workaround to get document.activeElement worked similar on Safari and Firefox on MacOS
// https://zellwk.com/blog/inconsistent-button-behavior/
document.addEventListener('click', function (event) {
if (event.target.matches('button')) {
event.target.focus()
}
})
});
</script>
<style>
......
......@@ -207,6 +207,14 @@
Foris.loadSubordinatesList();
Foris.afterAjaxUpdateFunctions.push(Foris.suboridnatesOverrideEditClose);
Foris.afterAjaxUpdateFunctions.push(Foris.overrideSubordinatesEditButton);
// Workaround to get document.activeElement worked similar on Safari and Firefox on MacOS
// https://zellwk.com/blog/inconsistent-button-behavior/
document.addEventListener('click', function (event) {
if (event.target.matches('button')) {
event.target.focus()
}
})
});
</script>
<style>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment