Spaces:
Sleeping
Sleeping
Fadhili Sumaye commited on
Commit ·
075ff85
1
Parent(s): 436892e
Fix auto-refresh resetting forms while typing in admin panel
Browse files- backend/admin.html +6 -0
backend/admin.html
CHANGED
|
@@ -421,6 +421,12 @@
|
|
| 421 |
}
|
| 422 |
|
| 423 |
async function fetchReports() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 424 |
try {
|
| 425 |
const response = await fetch('/admin/api/reports', {
|
| 426 |
headers: getAuthHeaders()
|
|
|
|
| 421 |
}
|
| 422 |
|
| 423 |
async function fetchReports() {
|
| 424 |
+
// Do not refresh reports while the user is actively typing to avoid losing form input
|
| 425 |
+
const activeEl = document.activeElement;
|
| 426 |
+
if (activeEl && (activeEl.tagName === 'INPUT' || activeEl.tagName === 'TEXTAREA')) {
|
| 427 |
+
return;
|
| 428 |
+
}
|
| 429 |
+
|
| 430 |
try {
|
| 431 |
const response = await fetch('/admin/api/reports', {
|
| 432 |
headers: getAuthHeaders()
|