How to make controller joysticks control scrolling?

3D WebView's prefabs detect input through Unity's event system like described in this article, however most XR controller SDKs (like the Meta Quest Integration SDK or XR Interaction Toolkit) don't automatically send scroll events when the controller joystick is moved. So, in order to make joysticks trigger scrolling, an application must include a script to detect when a joystick is moved and then call one of 3D WebView's IWebView.Scroll() methods. The scripting API needed to detect joystick movement will depend on the controller or XR SDK being used. For example, here's a simple script that uses the InputDevices class from the UnityEngine.XR package to detect the joystick:

using UnityEngine;
using UnityEngine.XR;
using Vuplex.WebView;

class XRJoystickScroller : MonoBehaviour {

    // TODO: Set this field to your WebViewPrefab via the Editor inspector.
    public WebViewPrefab webViewPrefab;

    void Update() {

        var rightController = InputDevices.GetDeviceAtXRNode(XRNode.RightHand);
        if (rightController.isValid && rightController.TryGetFeatureValue(CommonUsages.primary2DAxis, out var scrollDelta)) {
            if(scrollDelta[1] > 0) {
                webViewPrefab.WebView.Scroll(0, -5);
            } else if(scrollDelta[1] < 0) {
                webViewPrefab.WebView.Scroll(0, 5);
            }
        }
    }
}

And here's another example that uses the Meta Quest SDK's OVRInput class to detect the joystick:

using UnityEngine;
using Vuplex.WebView;

class QuestJoystickScroller : MonoBehaviour {

    // TODO: Set this field to your WebViewPrefab via the Editor inspector.
    public WebViewPrefab webViewPrefab;

    void Update() {

        if (OVRInput.Get(OVRInput.Button.PrimaryThumbstickUp)) {
            // Scroll up by 5px.
            webViewPrefab.WebView.Scroll(0, -5);
        } else if (OVRInput.Get(OVRInput.Button.PrimaryThumbstickDown)) {
            // Scroll down by 5px.
            webViewPrefab.WebView.Scroll(0, 5);
        }
    }
}