FLP: Setting Custom Initial Focus on App Launch Fails

梦想与她 提交于 2020-05-16 13:27:07

问题


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:

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.


回答1:


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




回答2:


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.



来源:https://stackoverflow.com/questions/55510704/flp-setting-custom-initial-focus-on-app-launch-fails

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!