Skip to main content

ActionControl

Base class for controls that can perform ClientAction work when they are activated.

Browsers only allow a page to open a file picker, write to the clipboard, show a share sheet or open a new tab while they are handling the user's click or key press. Sending that click to your Python code and acting on the reply takes longer than the permission lasts, so those operations are silently ignored on iOS Safari while Android and desktop browsers let them through. Controls inheriting from this class accept an action, which the client performs inside the original gesture instead.

Extension developers can inherit from this class to give their own controls the same capability; the client runs whatever actions the control declares before the control's own click event is dispatched.

Inherits: Control

Properties

  • action - Action(s) performed by the client when this control is activated, without a round trip to your Python code.

Properties

actionclass-attributeinstance-attribute

action: ClientAction | list[ClientAction] | None = None

Action(s) performed by the client when this control is activated, without a round trip to your Python code.

Use this for operations a browser only permits while it is handling the user's click, such as opening a file picker, writing to the clipboard, showing a share sheet or opening a new tab. See ClientAction.