-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Open
Labels
Description
Description
When using the Menu component from react-native-paper as a dropdown in an autocomplete-style UI, there is a UX inconsistency when the menu opens upwards from its anchor and its content is dynamically filtered.
Currently, when filtering the list while the menu is already open (e.g., user types to refine suggestions):
- The menu shrinks to fit the updated result set,
- But it does not maintain a fixed position relative to its anchor,
- Resulting in the menu shifting upward, giving the impression that it is disconnected from its triggering anchor.
This behavior is especially noticeable in autocomplete scenarios, where the menu’s height often changes as the user types.
Proposed Behavior
It would be beneficial if the Menu component:
- Could maintain visual alignment with its anchor, even when the content height changes,
- Especially when opened upward due to limited space below the anchor,
- Adjusted its top boundary instead of bottom when opened upward, preserving anchor binding.
This feature would greatly enhance the usability of the Menu in dynamic UIs, such as autocomplete components or filterable lists.
Suggested Enhancements
- Add a prop like
preserveAnchorAlignmentorstickToAnchorthat keeps the menu visually connected to the anchor during dynamic content changes. - Internally detect when the menu opens upward, and adjust only the top boundary to maintain anchor alignment when the height changes.
- Optionally expose a more flexible positioning strategy API for menus that change in size after mounting.