Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "Fix for keyboard focus is lost when hovering out of a menu",
"packageName": "@fluentui-react-native/menu",
"email": "email not defined",
"dependentChangeType": "patch"
}
7 changes: 5 additions & 2 deletions packages/components/Menu/src/MenuList/MenuList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,12 @@ export const MenuList = compose<MenuListType>({
const Slots = useSlots(menuList.props, (layer) => menuListLookup(layer, menuList, userProps));

const focusZoneRef = React.useRef<View>();
const setFocusZoneFocus = () => {
focusZoneRef?.current?.focus();
};

React.useEffect(() => {
focusZoneRef?.current?.focus();
setFocusZoneFocus();
}, []);

return (_final: MenuListProps, children: React.ReactNode) => {
Expand Down Expand Up @@ -83,7 +86,7 @@ export const MenuList = compose<MenuListType>({

const content =
Platform.OS === 'macos' ? (
<Slots.root>
<Slots.root onMouseLeave={setFocusZoneFocus}>
<Slots.scrollView
accessibilityRole="menu"
showsVerticalScrollIndicator={menuContext.hasMaxHeight}
Expand Down