onAcceleratorKeyPressed property

  1. @SupportedPlatforms.new(platforms: [WindowsPlatform(apiName: 'ICoreWebView2Controller.add_AcceleratorKeyPressed', apiUrl: 'https://learn.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/icorewebview2controller?view=webview2-1.0.2849.39#add_acceleratorkeypressed')])
void Function(T controller, AcceleratorKeyPressedDetail detail)? onAcceleratorKeyPressed
final

This event runs when an accelerator key or key combo is pressed or released while the WebView is focused. To listen this event, InAppWebViewSettings.handleAcceleratorKeyPressed must be true.

A key is considered an accelerator if either of the following conditions are true:

  • Ctrl or Alt is currently being held.
  • The pressed key does not map to a character.

A few specific keys are never considered accelerators, such as Shift. The Escape key is always considered an accelerator.

Auto-repeated key events caused by holding the key down also triggers this event. Filter out the auto-repeated key events by verifying the AcceleratorKeyPressedDetail.physicalKeyStatus property.

Officially Supported Platforms/Implementations:

Parameters - Officially Supported Platforms/Implementations:

  • detail: all platforms

Use the PlatformWebViewCreationParams.isPropertySupported method to check if this property is supported at runtime.

Implementation

@SupportedPlatforms(
  platforms: [
    WindowsPlatform(
      apiName: 'ICoreWebView2Controller.add_AcceleratorKeyPressed',
      apiUrl:
          'https://learn.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/icorewebview2controller?view=webview2-1.0.2849.39#add_acceleratorkeypressed',
    ),
  ],
)
final void Function(T controller, AcceleratorKeyPressedDetail detail)?
onAcceleratorKeyPressed;