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

Move Dialogs to Radix #5648

Merged
merged 6 commits into from
Oct 8, 2024
Merged

Move Dialogs to Radix #5648

merged 6 commits into from
Oct 8, 2024

Conversation

mozzius
Copy link
Member

@mozzius mozzius commented Oct 8, 2024

Adds Radix's focus-scope and focus-guard utilities to the dialogs and composer, so that they can compose properly with the dropdown menus. This means that dialogs and menus can now be nested, and the Escape key will work properly.

I also did the same to the composer, so now focus loops around when you get to the end

I also added nested sheet support to the menu component on native

Test plan

  1. Test the new Dialog with menu in it button in the Storybook (all platforms). Before these changes, this would've caused a recursion bug on firefox, so make sure that doesn't happen
  2. Test the dialogs on web, esp. with the keyboard. They should act the same
  3. Test the composer and the nested dialogs within it for regressions. again, should act the same but now with looping focus

estrattonbailey and others added 5 commits October 8, 2024 14:29
* Use Redix FocusTrap

* force resolutions on radix libs

* add focus guards

* use @radix-ui/dismissable-layer for escape handling

* fix banner menu keypress by using `Pressable`

* add menu in dialog example to storybook

---------

Co-authored-by: Samuel Newman <[email protected]>
Copy link
Member

@estrattonbailey estrattonbailey left a comment

Choose a reason for hiding this comment

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

Beautiful

@@ -90,14 +93,11 @@ export function UserBanner({

// setUserBanner is only passed as prop on the EditProfile component
return onSelectNewBanner ? (
<EventStopper onKeyDown={false}>
<EventStopper onKeyDown={true}>
Copy link
Member

Choose a reason for hiding this comment

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

Not sure we even need this anymore

Copy link
Member Author

Choose a reason for hiding this comment

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

oh cool! I'll follow up with a PR to remove those, wanna test thoroughly first so won't do it here

@@ -10,7 +10,9 @@ import {
import Animated, {FadeIn, FadeInDown} from 'react-native-reanimated'
import {msg} from '@lingui/macro'
import {useLingui} from '@lingui/react'
import {FocusScope} from '@tamagui/focus-scope'
Copy link
Contributor

@haileyok haileyok Oct 8, 2024

Choose a reason for hiding this comment

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

Can we remove this library now?

@arcalinea arcalinea temporarily deployed to samuel/dialog-menu-nesting - social-app PR #5648 October 8, 2024 17:00 — with Render Destroyed
@mozzius mozzius merged commit fc82d2f into main Oct 8, 2024
4 of 6 checks passed
@mozzius mozzius deleted the samuel/dialog-menu-nesting branch October 8, 2024 17:00
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

Successfully merging this pull request may close these issues.

4 participants