Skip to content

Conversation

@Nitin-100
Copy link
Contributor

@Nitin-100 Nitin-100 commented Feb 3, 2026

Description

This PR fixes the SHIFT+F10 keyboard shortcut not working to show the context menu in TextInput components. Previously, pressing SHIFT+F10 would cause the application's File menu to blink instead of showing the TextInput context menu.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)

Why

The SHIFT+F10 keyboard shortcut is a standard Windows accessibility feature for opening context menus. Users expect this shortcut to work in TextInput fields to access cut/copy/paste operations via keyboard.

Root Cause: Windows intercepts SHIFT+F10 at the system level. For ContentIsland hosting, the InputKeyboardSource.ContextMenuKey event wasn't being handled, so the event would fall through and activate the application's menu bar instead.

What

The following changes were made to fix the issue:

  1. Added OnContextMenu virtual method to ComponentView - Base class method that derived components can override to handle context menu requests.

  2. Added ContextMenuKey event handler in CompositionEventHandler - For ContentIsland hosting, this subscribes to InputKeyboardSource.ContextMenuKey and routes the event to the focused component's OnContextMenu method.

  3. Added WM_CONTEXTMENU handling in CompositionEventHandler::SendMessage - For HWND hosting (CompositionHwndHost), this routes the WM_CONTEXTMENU message to the focused component.

  4. Implemented OnContextMenu in WindowsTextInputComponentView - Calls ShowContextMenu() when the context menu is not hidden via props.

Screenshots

N/A

Testing

Manual Testing Performed:

  • Verified SHIFT+F10 now shows the context menu in TextInput
  • Verified right-click context menu still works
  • Verified contextMenuHidden prop still prevents context menu from appearing

Test Scenarios:

  1. TextInput with focus + SHIFT+F10 → Context menu appears
  2. TextInput with contextMenuHidden={true} + SHIFT+F10 → No context menu
  3. Right-click on TextInput → Context menu appears

Changelog

Should this change be included in the release notes: yes

Fixed SHIFT+F10 keyboard shortcut not showing context menu in TextInput components.

}
}

void ComponentView::OnContextMenu(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It shouldn't be necessary to inject additional input into the ReactNativeIsland.

The ContentIsland should provide all that we need here.

Either we should be listening directly to the key events, or there is / should be some ContentIsland event that corresponds to WM_CONTEXTMENU.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah!Right!
I've updated the implementation to use InputKeyboardSource.ContextMenuKey event instead of adding a new public API to ReactNativeIsland. The ContextMenuKey event fires when the Menu key (or Shift+F10) is unhandled from KeyDown, which is exactly what we need.

Removed:
-NotifyContextMenu API from ReactNativeIsland
-WM_CONTEXTMENU handler
Added:
-ContextMenuKey event subscription in CompositionEventHandler for ContentIsland hosting
-Kept WM_CONTEXTMENU handling in SendMessage for HWND hosting (CompositionHwndHost)

@microsoft-github-policy-service microsoft-github-policy-service bot added the Needs: Author Feedback The issue/PR needs activity from its author (label drives bot activity) label Feb 3, 2026
@Nitin-100 Nitin-100 force-pushed the nitin/fix-contextmenu-shiftf10 branch from 8c0bda7 to 525ebd2 Compare February 3, 2026 19:01
@microsoft-github-policy-service microsoft-github-policy-service bot removed the Needs: Author Feedback The issue/PR needs activity from its author (label drives bot activity) label Feb 3, 2026
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.

[React Native] [Amazon Kindle][60873901] Bug 2 - SHIFT F10 context menu keyboard shortcut does not work.

2 participants