web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Microsoft Dynamics 365 | Integration, Dataverse...
Suggested Answer

powerapps SetFocus() sometimes not working

(2) ShareShare
ReportReport
Posted on by 9

I just use SetFocus(TextInput) to scroll to the bottom of a form. When I click "F5" to preview the app, it always works. 

However, after publishing the app, TextInput didn't get focus for 20% chance.

I have the same question (0)
  • Suggested answer
    Inogic Profile Picture
    743 on at
    Hi,
     
    This behavior is a known timing issue in Power Apps, not a problem with formula.
    SetFocus() works reliably in Preview (F5) but can intermittently fail in the published app because of how Power Apps renders controls.
    Why this happens, because In Preview mode, screens and controls load more predictably. But in the published app, screens render faster and asynchronously.

    SetFocus() executes before the TextInput control is fully rendered and when the control is not yet rendered, Power Apps silently ignores the focus request. This results in intermittent behavior (for example, failing 20% of the time).

    - Important limitation of SetFocus()
    SetFocus() only works when:
    1)The control is already rendered
    2)The control is visible and enabled
    3)If these conditions are not met at execution time, focus will not be applied.

    - Recommended & Practical Solution
    Use a hidden Timer to delay SetFocus, this is the most stable approach for published apps.
    Steps: 
    1)Add a Timer control with Duration: 300 (increase to 400–500 ms if needed)
    2)AutoStart: false
    3)Repeat: false
    4)Visible: false
    5)Screen → OnVisible
    6)Reset (Timer1)
    7)Start (Timer1)
    8)Timer → OnTimerEnd
    9)SetFocus(TextInput1)

    Why this works:
    The timer ensures the screen and controls are fully rendered before calling SetFocus().

    - Alternative Approaches
    Using a variable-based delay :- Set(varFocus, true)
    Then trigger SetFocus() based on user interaction or another control’s event.
    This may work in some cases but is not as reliable as the timer.

    Hope this helps.
     
    Thanks!
    Inogic

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > Microsoft Dynamics 365 | Integration, Dataverse, and general topics

#1
BillurSamdancioglu Profile Picture

BillurSamdancioglu 95 Most Valuable Professional

#1
BillurSamdancioglu Profile Picture

BillurSamdancioglu 95 Most Valuable Professional

#3
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 80 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans