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> render props should include focus states #6384

Open
andrew-pledge-io opened this issue May 14, 2024 · 0 comments
Open

<Dialog> render props should include focus states #6384

andrew-pledge-io opened this issue May 14, 2024 · 0 comments

Comments

@andrew-pledge-io
Copy link

andrew-pledge-io commented May 14, 2024

Provide a general summary of the feature here

<Dialog> renders a <section> element and controls when it is focused.

It would be helpful if the className and children both accepted callbacks that included the focus state of the dialog, e.g. isFocused and isFocusVisible, like other react-aria components.

🤔 Expected Behavior?

children and className should both accept callbacks that receive the focused state.

😯 Current Behavior

<Dialog> render props only include a close callback:

interface DialogRenderProps {
close: () => void
}

Only children accepts a callback. className only accepts strings:

export interface DialogProps extends AriaDialogProps, StyleProps, SlotProps {
/** Children of the dialog. A function may be provided to access a function to close the dialog. */
children?: ReactNode | ((opts: DialogRenderProps) => ReactNode)
}

💁 Possible Solution

No response

🔦 Context

I'm using render props to conditionally apply focus styles in other react-aria components, however I can't do so when using <Dialog>.

I'm currently working around the problem by using native CSS pseudo-classes, which is fine but inconsistent.

💻 Examples

No response

🧢 Your Company/Team

No response

🕷 Tracking Issue

No response

@andrew-pledge-io andrew-pledge-io changed the title Dialog render props should include focus states <Dialog> render props should include focus states May 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant