Fix iOS Safari auto-zoom on input fields
- Changed all input/textarea/select font-size from text-sm to text-base (16px minimum) - Added blur handler to reset viewport zoom on InlineItemCreate - Prevents iOS Safari from auto-zooming when focusing on form fields - Ensures zoom resets properly when closing forms
This commit is contained in:
@@ -63,6 +63,10 @@ export default function InlineItemCreate({ listId }: InlineItemCreateProps) {
|
||||
const handleCancel = () => {
|
||||
setTitle('')
|
||||
setIsCreating(false)
|
||||
// Reset zoom on iOS Safari
|
||||
if (document.activeElement instanceof HTMLElement) {
|
||||
document.activeElement.blur()
|
||||
}
|
||||
}
|
||||
|
||||
const handleKeyDown = (e: React.KeyboardEvent) => {
|
||||
@@ -71,6 +75,11 @@ export default function InlineItemCreate({ listId }: InlineItemCreateProps) {
|
||||
}
|
||||
}
|
||||
|
||||
const handleBlur = () => {
|
||||
// Force viewport reset on iOS Safari
|
||||
window.scrollTo(0, 0)
|
||||
}
|
||||
|
||||
if (!isCreating) {
|
||||
return (
|
||||
<button
|
||||
@@ -94,10 +103,11 @@ export default function InlineItemCreate({ listId }: InlineItemCreateProps) {
|
||||
setError('')
|
||||
}}
|
||||
onKeyDown={handleKeyDown}
|
||||
onBlur={handleBlur}
|
||||
placeholder="Enter task title..."
|
||||
autoFocus
|
||||
maxLength={200}
|
||||
className={`w-full px-3 sm:px-4 py-3 border rounded-lg focus:outline-none focus:ring-2 text-sm sm:text-base ${
|
||||
className={`w-full px-3 sm:px-4 py-3 border rounded-lg focus:outline-none focus:ring-2 text-base ${
|
||||
error ? 'border-red-500 focus:ring-red-500' : 'border-gray-300 focus:ring-blue-500'
|
||||
}`}
|
||||
aria-invalid={error ? 'true' : 'false'}
|
||||
|
||||
Reference in New Issue
Block a user