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, AlertDialog] Fix trigger issues #808

Merged
merged 7 commits into from
Nov 8, 2024

Conversation

michaldudak
Copy link
Member

Refactored the implementation of the Dialog to be more in line with other popup-like components by delegating the trigger logic to Floating UI.

This fixes two issues:
fixes #618
fixes #619

@michaldudak michaldudak added component: AlertDialog The React component. bug 🐛 Something doesn't work component: dialog This is the name of the generic UI component, not the React module! labels Nov 6, 2024
@mui-bot
Copy link

mui-bot commented Nov 6, 2024

Netlify deploy preview

https://deploy-preview-808--base-ui.netlify.app/

Generated by 🚫 dangerJS against 0016fcb

@@ -38,17 +38,12 @@ const AlertDialogBackdrop = React.forwardRef(function AlertDialogBackdrop(
forwardedRef: React.ForwardedRef<HTMLDivElement>,
) {
const { render, className, keepMounted = false, ...other } = props;
const { open, hasParentDialog, setBackdropPresent, animated } = useAlertDialogRootContext();

const handleMount = React.useCallback(() => setBackdropPresent(true), [setBackdropPresent]);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't bother refactoring this as we won't need this logic anyway after #623

@michaldudak michaldudak marked this pull request as ready for review November 6, 2024 20:34
@atomiks
Copy link
Contributor

atomiks commented Nov 6, 2024

In Safari:

  • Under the Nested section demo, focus the Open trigger with Tab/keyboard and click with Enter
  • Press Escape
  • Scroll back to the top introduction demo
  • With your pointer, click the trigger
  • Press Escape
  • Focus moves back to the Nested open trigger incorrectly, not the intro trigger

@michaldudak
Copy link
Member Author

Safari should work fine now.

@michaldudak michaldudak merged commit a43de8f into mui:master Nov 8, 2024
22 checks passed
@michaldudak michaldudak deleted the dialog-refactoring branch November 8, 2024 08:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something doesn't work component: AlertDialog The React component. component: dialog This is the name of the generic UI component, not the React module!
Projects
None yet
4 participants