Modal content
Content
Content
Content
Content
Content
Content
First paragraph
Second paragraph
@@ -116,4 +130,33 @@ describe('Modal', () => { expect(screen.getByText('Second paragraph')).toBeInTheDocument(); expect(screen.getByRole('button', { name: 'Action Button' })).toBeInTheDocument(); }); + + it('restores focus to the previously focused element on close', async () => { + const user = userEvent.setup(); + + function Harness() { + const [open, setOpen] = useState(false); + return ( + <> + + {open && ( +Content
+