FLP: Setting Custom Initial Focus on App Launch Fails
Asked Answered
M

2

2

I am trying to set initial focus to the first input field in each page of my app.

I have implemented the code in the following post and it is working great:

How to Set Initial Focus in a View?

But I found that it is not working for first view/page in app when it opens from Fiori Launchpad. I found the following code which is getting executed after my onAfterShow:

In <code>https://ui5.sap.com/resources/sap/ushell/renderers/fiori2/Shell-dbg.controller.js</code> From sap/ushell/renderers/fiori2/Shell-dbg.controller.js

Could you please help to solve this? I am using SAP UI5 version 1.56.7.

Masochism answered 4/4, 2019 at 7:59 Comment(0)
X
0

Update: the issue is no longer reproducible since SAPUI5 1.104.0. See my comment at https://github.com/SAP/openui5/issues/3602#issuecomment-1446259384


Previous answer:

Author of that answer here. After browsing through the source code and documentation quite a while, I have to admit I couldn't find any acceptable solutions to this question either. My impression is that FLP developers want to make sure that the app doesn't interfere with setting the initial focus.

The lack of APIs and documentation thereof strongly suggests that there are compelling reasons behind this prevention (probably a11y related).

My advice is not to rely on timeouts but maintaining consistent UX by keeping the focus on the app title on its launch - as designed by SAP.

Xerophthalmia answered 5/3, 2020 at 8:40 Comment(0)
M
-1

Solved the issue by passing around 200ms into setTimeout function for first page and it is working fine

Masochism answered 16/4, 2019 at 6:24 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.