Get currently focused field?

Which product are you using?
PDF.js Express Plus

PDF.js Express Version
8.7.0

Detailed description of issue
We would like to mimic the Docusign feature of clicking a button that will automatically move focus to the next field (which can be done by hitting tab, but that doesn’t work on mobile) or to focus on the next signature or initial field.

How can we accomplish this? Is there a way to know via JS which field has focus that so we can set focus forward to the next input field?

Expected behaviour
Some event, method, or css class we can hook to in order to find fields and fields types, and the ability to set focus on that field from JS

Does your issue happen with every document, or just one?

Link to document

Code snippet

Thank you for posting your question to our forum. We will provide you with an update as soon as possible.

Hi there,

For form fields, they are widgets and have an HTML input element representing the field:

An example way to focus this would be to call the native .focus on the html element, i.e.

// example on down arrow key press 
 UI.hotkeys.on(UI.hotkeys.Keys.DOWN, e => {
    e.preventDefault();
    console.log('on down');
    // assuming targeted annotation is a widget
    annotationManager.getAnnotationsList()[0].getInnerElement().focus()
  });

Best regards,
Kevin Kim