Fix login button — use onPointerUp for cross-platform touch support

This commit is contained in:
2026-04-26 12:56:06 -04:00
parent 7e87cca663
commit 1495c2baef
+7 -5
View File
@@ -1,6 +1,6 @@
'use client';
import { useState, useRef } from 'react';
import { useRef, useState } from 'react';
export default function LoginPage() {
const [error, setError] = useState('');
@@ -19,7 +19,7 @@ export default function LoginPage() {
credentials: 'include',
body: JSON.stringify({ password }),
});
if (!res.ok) throw new Error('Invalid password');
if (!res.ok) throw new Error('bad');
window.location.href = '/';
} catch {
setError('Invalid password');
@@ -58,9 +58,8 @@ export default function LoginPage() {
ref={inputRef}
type="password"
placeholder="Password"
autoFocus
autoComplete="current-password"
onKeyDown={e => e.key === 'Enter' && handleLogin()}
onKeyDown={e => { if (e.key === 'Enter') handleLogin(); }}
style={{
width: '100%',
background: '#faf9f6',
@@ -73,6 +72,7 @@ export default function LoginPage() {
marginBottom: error ? '6px' : '16px',
display: 'block',
boxSizing: 'border-box',
WebkitAppearance: 'none',
}}
/>
@@ -83,7 +83,7 @@ export default function LoginPage() {
)}
<button
onClick={handleLogin}
onPointerUp={handleLogin}
style={{
width: '100%',
background: '#2d5a3d',
@@ -95,6 +95,8 @@ export default function LoginPage() {
cursor: 'pointer',
display: 'block',
boxSizing: 'border-box',
WebkitAppearance: 'none',
touchAction: 'manipulation',
}}
>
{loading ? 'Signing in...' : 'Sign in'}