feat: Add Enter key support for admin password input
UX improvement: - Password input now accepts Enter key to submit - Added onkeypress=handleAdminKeyPress(event) to input field - New function handleAdminKeyPress(e) checks for Enter key - Enter key triggers submitAdminLogin() Implementation: - Modified showAdminLoginModal() to add onkeypress handler - Added handleAdminKeyPress(e) function - Supports both e.key==='Enter' and e.keyCode===13 (cross-browser) User workflow: 1. Open Settings → Password modal appears 2. Type password: admin123 3. Press Enter → Login submits (no need to click button) 4. Or click Login button → Both methods work Files changed: src/page.html (+8 lines) UX: Faster login, keyboard-friendly interface
This commit is contained in:
@@ -197,7 +197,7 @@ function showAdminLoginModal(){
|
||||
m.id='mb-admin-modal';
|
||||
m.innerHTML='<button class=mb-admin-close onclick=this.parentElement.classList.remove("active")>✕</button>'+
|
||||
'<div class=mb-admin-title>Admin Authentication Required</div>'+
|
||||
'<input class=mb-admin-input type=password id=admin-password placeholder="Enter admin password">'+
|
||||
'<input class=mb-admin-input type=password id=admin-password placeholder="Enter admin password" onkeypress=handleAdminKeyPress(event)>'+
|
||||
'<button class=mb-admin-btn onclick=submitAdminLogin()>Login</button>'+
|
||||
'<div class=mb-admin-error id=admin-error></div>';
|
||||
document.body.appendChild(m);
|
||||
@@ -209,6 +209,12 @@ function showAdminLoginModal(){
|
||||
document.getElementById('admin-password').focus();
|
||||
}
|
||||
|
||||
function handleAdminKeyPress(e){
|
||||
if(e.key==='Enter'||e.keyCode===13){
|
||||
submitAdminLogin();
|
||||
}
|
||||
}
|
||||
|
||||
function submitAdminLogin(){
|
||||
var pwd=document.getElementById('admin-password').value;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user