<-- Back

How to set initial autofocus on text widgets for mobile devices

Introduction

The autofocus feature for text widgets is not activated when the application is accessed on mobile devices. This is the standard behavior in Mendix applications, as they operate differently on mobile platforms compared to desktops.

Environment/Prerequisites

  • Progressive Web App (PWA)
  • Native Mobile
  • Android
  • iOS

Instructions/Procedure

To address the situation described, please follow the steps outlined below to establish a workaround.

  1. Install the Mendix Web Actions module:

  2. Create a Nanoflow to open the desired page

  3. Add the Create Variable activity of data type String

  4. Insert .mx-name- in the Value space. It should be .mx-name- followed by the name of the input element that needs to be autofocused

nanoflow_variable2.jpg

  1. Add the activity Set Focus at the end of the Nanoflow flow

The Nanoflow should look like the image below:

Nanoflow_set_focus.png

Outcome

The text input field should automatically gain focus when the application is launched on a mobile device.

Internal information related

  • 217254
  • UFC-1264
Have more questions? Submit a request

0 Comments

Article is closed for comments.

To provide feedback, please open a ticket here. Don't forget to include the article's URL along with the feedback you would like to provide.