ICoreWebView2Controller.MoveFocus

Moves focus into WebView. WebView gets focus and focus is set to correspondent element in the page hosted in the WebView. For Programmatic reason, focus is set to previously focused element or the default element if no previously focused element exists. For Next reason, focus is set to the first element. For Previous reason, focus is set to the last element. WebView changes focus through user interaction including selecting into a WebView or Tab into it. For tabbing, the app runs MoveFocus with Next or Previous to align with Tab and Shift+Tab respectively when it decides the WebView is the next element that may exist in a tab. Or, the app runs IsDialogMessage as part of the associated message loop to allow the platform to auto handle tabbing. The platform rotates through all windows with WS_TABSTOP. When the WebView gets focus from IsDialogMessage, it is internally put the focus on the first or last element for tab and Shift+Tab respectively.

\snippet App.cpp MoveFocus0

\snippet ControlComponent.cpp MoveFocus1

\snippet ControlComponent.cpp MoveFocus2

interface ICoreWebView2Controller
HRESULT
MoveFocus
(
in COREWEBVIEW2_MOVE_FOCUS_REASON reason
)

Meta