Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dialog animation fails if element has autoFocus #6012

Open
andrecasal opened this issue Mar 6, 2024 · 0 comments
Open

Dialog animation fails if element has autoFocus #6012

andrecasal opened this issue Mar 6, 2024 · 0 comments

Comments

@andrecasal
Copy link

Provide a general summary of the issue here

Dialog animation fails if element has autoFocus.

πŸ€” Expected Behavior?

Expected animation to work.

😯 Current Behavior

Animation is janky.

πŸ’ Possible Solution

No response

πŸ”¦ Context

No response

πŸ–₯️ Steps to Reproduce

  1. Take the following code, with the tailwind-animate plugin:
import { ModalOverlay, Modal, Dialog, DialogTrigger, Button } from 'react-aria-components'

const Test = () => {
	return (
		<DialogTrigger>
			<Button>Open modal</Button>
			<ModalOverlay className="fixed inset-0 flex items-center justify-end overflow-hidden bg-black/25 backdrop-blur duration-300 ease-out animate-in fade-in">
				<Modal className="w-96 bg-white duration-300 ease-out animate-in slide-in-from-right">
					<Dialog>
						<textarea className="border" autoFocus />
					</Dialog>
				</Modal>
			</ModalOverlay>
		</DialogTrigger>
	)
}

export default Test
  1. Notice how the dialog doesn't animate properly.
  2. Notice how removing autoFocus from the <textarea /> makes the animation work again.

Notes:
While having <textarea autoFocus /> animating from the left or top works, but animating from right or bottom doesn't.

Version

1.0.1

What browsers are you seeing the problem on?

Firefox, Chrome

If other, please specify.

No response

What operating system are you using?

macOS Sonoma 14.3.1

🧒 Your Company/Team

https://verveui.pro/components/modals/dialog

πŸ•· Tracking Issue

No response

@LFDanLu LFDanLu added good first issue Good for newcomers bug Something isn't working and removed bug Something isn't working good first issue Good for newcomers labels Mar 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants