How to trigger click events on UI elements via keyboard or gamepad when using UI Toolkit

My game needs to support gamepad and keyboard.
And I am using new UI Toolkit (UI elements)

So some buttons look like this picture.

They need to support both input methods:

  1. direct mouse click
  2. via gamepad and keyboard (e.g. here it's by pressing Esc)

Also, when the button triggers a click event, I need to add some logic within the UI, such as animations and effects.

So how to trigger on here by keyboard or gamepad:

using System;
using UnityEditor;
using UnityEngine;
using UnityEngine.UIElements;

namespace UnityEngine.UIElements {
  public class Btn : VisualElement {
    public new class UxmlFactory : UxmlFactory<Btn, UxmlTraits> { }
    public Btn() {
      var template = Resources.Load<VisualTreeAsset>($"CustomUI/Elements/Btn");

      this.RegisterCallback<MouseDownEvent>((e) => {
        // HERE:
        // First, Some UI login such as animations and effects.
        // So how to trigger, by pressing the Esc key.

Hi littenli, did you find a solution for the trigger using the escape key ?