# Change Script Focus in 8.3

**URL:** <https://forum.inductiveautomation.com/t/change-script-focus-in-8-3/117683>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [October 31, 2026, 4:43am UTC](https://forum.inductiveautomation.com/t/change-script-focus-in-8-3/117683 "2026-10-31T04:43:56Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![jjhamon16](https://avatars.discourse-cdn.com/v4/letter/j/ac8455/32.png) [@jjhamon16](https://forum.inductiveautomation.com/u/jjhamon16)\
**Post date:** [October 31, 2026, 4:43am UTC](https://forum.inductiveautomation.com/t/change-script-focus-in-8-3/117683/1 "2026-10-31T04:43:56Z")

</div>

**Title: Ignition Perspective 8.3 – `self.focus()` works from button events but not property change or startup scripts**

I'm using **Ignition 8.3 (Perspective)** and trying to automatically set focus to a Text Field when an Embedded View loads.

The Text Field is the first input in a four-digit authentication screen. Ideally, when the operator navigates to this screen, the cursor should automatically be placed in the first field so they can immediately begin entering their code.

I'm using the documented `focus()` method:

```python
self.focus()

```

I've tested several approaches with the following results:

- **Button `onActionPerformed`:** Works correctly.

- **Button `onMouseEnter`:** Works correctly.

- **Text Field `onStartup`:** Does not focus the field.

- **Property-change script:** Executes, but does not focus the field.

- **Message handler:** Executes, but does not focus the field.

I also have a reset function that clears all four inputs and calls `focus()` on the first field. When invoked from a button, both the reset and focus work. When invoked from a property-change script, the inputs reset correctly, but focus is never applied.

I've confirmed the component path is correct, and the scripts are executing using print statements.

This initially appeared to be an Embedded View loading/timing issue, but I've also been unable to get automatic focus working when testing the authentication view independently.

**Has anyone successfully used `self.focus()` from a property-change script or `onStartup` event in Ignition Perspective 8.3?**

Is this a known limitation related to the event context or browser rendering, or is there a recommended way to automatically focus a Text Field after a view loads without requiring user interaction?

Any suggestions would be appreciated!

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [October 31, 2026, 1:32pm UTC](https://forum.inductiveautomation.com/t/change-script-focus-in-8-3/117683/2 "2026-10-31T13:32:55Z")

</div>

See the browser constraint discussed here:

> [@Textfield Auto focus](https://forum.inductiveautomation.com/t/textfield-auto-focus/117622/3):
>
> .focus() only works when the component is inside a container that already has focus, so you might try focusing its parent container(s) first. You can steal focus from a parent or sibling, but not a cousin.

---

<div class="post-metadata">

**Author:** ![Ryan\_Deardorff](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ryan_deardorff/32/63815_2.png) [@Ryan\_Deardorff](https://forum.inductiveautomation.com/u/Ryan_Deardorff)\
**Post date:** [October 31, 2026, 1:46pm UTC](https://forum.inductiveautomation.com/t/change-script-focus-in-8-3/117683/3 "2026-10-31T13:46:21Z")

</div>

Unfortunately there is no `onLoad` event yet that can be used to trigger such things once every part of a view is finished rendering, which is often necessary for things like `.focus()` to work. There is a request for it that one can vote for:

> **[Perspective view onLoad event that fires when the view is done loading |...](https://inductiveautomation.canny.io/ignition-features-and-ideas/p/perspective-view-onload-event-that-fires-when-the-view-is-done-loading)**
>
> This would be the only clean way of ensuring that, for example, an input .focus() would execute at the right time... https://forum.inductiveautomation.

In lieu of that, I have often found the easiest way to ensure focus happens when I want it to is to use `time.sleep()`:

```python
import time

def focusMe():
	time.sleep(0.5)
	self.focus()
	
system.util.invokeAsynchronous(focusMe)

```

Always use `system.util.invokeAsynchronous()` when using `.sleep()`, because it blocks the thread that it runs on. It's a hack that uses an estimate of how much time will be required for the view to finish loading, and is not ideal, so if you _can_ figure out another event that would invoke it at the right time, then do that.

---

<div class="post-metadata">

**Author:** ![jjhamon16](https://avatars.discourse-cdn.com/v4/letter/j/ac8455/32.png) [@jjhamon16](https://forum.inductiveautomation.com/u/jjhamon16)\
**Post date:** [October 31, 2026, 1:52pm UTC](https://forum.inductiveautomation.com/t/change-script-focus-in-8-3/117683/4 "2026-10-31T13:52:46Z")

</div>

I saw the topic you referenced while I was troubleshooting. I tried to implement focusing on a parent but wasnt sure if I was implementing correctly and didnt make progress. My text field is in flex containers root\>Main\>Code and has name digit\_1. Tried setting focus on each in turn to get down to my text field but got errors about None types. That's when I created my topic here.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [October 31, 2026, 2:38pm UTC](https://forum.inductiveautomation.com/t/change-script-focus-in-8-3/117683/5 "2026-10-31T14:38:06Z")

</div>

> [@jjhamon16](#):
>
> but got errors about None types

That is the symptom when the script is running before the view is fully loaded, as Ryan describes.
