ContextualMenu - Only show scrollbars if we specify maxHeight/maxWidth #1611
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Platforms Impacted
Description of changes
Note: This PR requires microsoft/react-native-macos#1135 to land and get back ported as a prerequisite
On macOS, there are 2 types of scrollbars that you can switch between in user preferences:
The former legacy style scrollbars add some margins to the scroll views' shadow view in order to account for the scroll bars. There is a race condition during layout of our ContextualMenu where the margins may show up even if we don't have a need for the scrollbars because all the content is visible. This was rather awkward, and a pretty big visual bug in ContextualMenu.
Screen.Recording.2022-04-25.at.1.43.47.AM.mov
We can fix this by telling ContextualMenu to only show scroll bars when we need them, AKA, when the user specified a maxHeight for vertical scrollbars, or maxWidth for horizontal scrollbars.
Verification
I tested a few different menus on our ContextualMenu test page, including one that wants a scrollbar and one that doesn't. Apart from that very last submenu, things seem to be laying out correctly.
Screen.Recording.2022-04-25.at.3.32.25.AM.mov
Pull request checklist
This PR has considered (when applicable):