Replies: 3 comments 1 reply
-
I will add this to Discussions and also happen to be in favor of this. |
Beta Was this translation helpful? Give feedback.
-
Honestly even more than just the focused option everything needed to manage scroll could be passed: the proper list of filtered options, the focused option, and whether the scroll should update if it's offscreen. |
Beta Was this translation helpful? Give feedback.
-
@SoAsEr I am happy to report that #3360 is being merged and released with version 4.3 today so that focusedOption will not be passed as a prop to the MenuList. |
Beta Was this translation helpful? Give feedback.
-
When creating a virtualized select, the easiest way to do so is to use react-window. However, this completely breaks auto scrolling when using the arrow keys. If the focused option index or value was passed as a prop to MenuList, this would be trivial to do correctly. Right now (AFAIK) the only reliable way of doing this sets a ref in the ariaLiveMessages onFocus function and then reads that ref in the MenuList component in a useEffect and scrolls if needed. This last part is also ugly, as it needs to iterate over its children and compare props as that's the only way it can access the filtered options.
It is possible that there is a way of doing this cleanly that I'm unaware of, but as far as I can tell the focused option is only ever presented to user side code through the isFocused Option prop and ariaLiveMessages.
Beta Was this translation helpful? Give feedback.
All reactions