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

Switch Menu components to Pressable #2147

Merged
merged 15 commits into from
Oct 18, 2022
Merged

Conversation

Saadnajmi
Copy link
Collaborator

@Saadnajmi Saadnajmi commented Sep 21, 2022

Platforms Impacted

  • iOS
  • macOS
  • win32 (Office)
  • windows
  • android

Description of changes

Helps to resolve #1035

Back in RN 0.62, we forked RN Core's Pressable, with the intention of eventually removing that fork. We've gone through the effort of updating React Native Core, Windows, Win32, macOS, and the DefinitelyTyped types to make sure that the upstream pressable supports all the hover/focus/press states and types we need. Let's complete this work by replacing our components one by one with Pressable.

Specifically, we should replace references of "useAsPressable" (which uses our fork) with "usePressableState" (which is designed to work with React Native's Pressable.

Verification

Tested that hover/focus/press still work on macOS ContextualMenu.
Tested that Menu items and disabled menu items are read correctly by VoiceOver
Tested that keyboarding accessibility still behaves as expected

Pull request checklist

This PR has considered (when applicable):

  • Automated Tests
  • Documentation and examples
  • Keyboard Accessibility
  • Voiceover
  • Internationalization and Right-to-left Layouts

@Saadnajmi Saadnajmi closed this Sep 21, 2022
@Saadnajmi Saadnajmi reopened this Sep 22, 2022
@Saadnajmi
Copy link
Collaborator Author

Saadnajmi commented Sep 22, 2022

This one will probably need to wait on both the RN 0.68 bump and the new next DefinitelyTyped package to update so we can get the over props with out TS yelling at us. Otherwise I can suppress the TS errors temporarily.

@Saadnajmi Saadnajmi mentioned this pull request Sep 22, 2022
10 tasks
@Saadnajmi Saadnajmi marked this pull request as ready for review September 22, 2022 16:41
@Saadnajmi Saadnajmi requested a review from a team as a code owner September 22, 2022 16:41
@Saadnajmi Saadnajmi changed the title [Draft] Switch Menu components to use React Native Pressable Switch Menu components to use React Native Pressable Sep 22, 2022
@Saadnajmi
Copy link
Collaborator Author

I think the CI errors can be fixed after #2157 merges

@Saadnajmi Saadnajmi changed the title Switch Menu components to use React Native Pressable Switch Menu components to Pressable Oct 15, 2022
@harrieshin
Copy link
Collaborator

"Tested that hover/focus/press still work on macOS ContextualMenu." --> can you expand your description on your test cases here? keyboard accessibility, screenreader etc.

@Saadnajmi
Copy link
Collaborator Author

"Tested that hover/focus/press still work on macOS ContextualMenu." --> can you expand your description on your test cases here? keyboard accessibility, screenreader etc.

Updated with notes about VoiceOver and keyboard accessibility.

@Saadnajmi Saadnajmi merged commit f5aafd7 into microsoft:main Oct 18, 2022
lawrencewin pushed a commit to lawrencewin/fluentui-react-native that referenced this pull request Oct 18, 2022
* Switch Menu components to use React Native Pressable

* Change files

* Update slots and snapshots

* Use PressablePropsExtended

* MenuItem*Info

* Fix ci

* snapshot

* Update disabled behavor handling
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.

Replace uses of "UseAsPressable" with "usePressableState"
3 participants