-
I've got a Right now when the modal appears, the first tab (the tab link itself) is given focus but I'd rather pass focus to the first field element which is fine as default behaviour. See reproduction here: Perhaps if there were a This could be too prescriptive - but what if we passed a |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 11 replies
-
This is what I see when I click that button: Side comment, it would be nice if we could turn off the focus highlight. Although this seems to only show in Safari. |
Beta Was this translation helpful? Give feedback.
-
I've released
import React, { useState } from "react";
import { Button, Input, Tabs, Tab, Modal } from "@mantine/core";
export default function App() {
const [isOpen, setOpen] = useState(false);
return (
<div>
<Button onClick={() => setOpen(true)}>Open Modal</Button>
<Modal opened={isOpen} onClose={() => setOpen(false)} hideCloseButton>
<Tabs>
<Tab label="First Tab">
<Input data-autofocus placeholder="Should have focus!" />
</Tab>
<Tab label="Second Tab">Test</Tab>
<Tab label="Third Tab">Test</Tab>
</Tabs>
</Modal>
</div>
);
} |
Beta Was this translation helpful? Give feedback.
I've released
1.3.0-alpha-0
with new autofocus feature for use-focus-trap hook. Here is my findings and solution:[data-focusable]
selector handling to specify initial focus element