# Keyboard Focus Issue with system.gui.confirm Popup (Enter Key Always Selects Yes)

**URL:** <https://forum.inductiveautomation.com/t/keyboard-focus-issue-with-system-gui-confirm-popup-enter-key-always-selects-yes/112306>\
**Category:** Ignition\
**Tags:** ignition81, vision\
**Created:** [November 20, 2025, 12:20pm UTC](https://forum.inductiveautomation.com/t/keyboard-focus-issue-with-system-gui-confirm-popup-enter-key-always-selects-yes/112306 "2025-11-20T12:20:11Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![devaraj.v](https://avatars.discourse-cdn.com/v4/letter/d/ecccb3/32.png) [@devaraj.v](https://forum.inductiveautomation.com/u/devaraj.v)\
**Post date:** [November 20, 2025, 12:20pm UTC](https://forum.inductiveautomation.com/t/keyboard-focus-issue-with-system-gui-confirm-popup-enter-key-always-selects-yes/112306/1 "2025-11-20T12:20:11Z")

</div>

* * *

Hello,

I am experiencing an issue with the built-in Ignition function:  
`system.gui.confirm(confirmationText, "Confirm Action")`.

When the confirmation popup appears, mouse interactions work correctly:

- Clicking **Yes** performs the Yes action

- Clicking **No** performs the No action

However, the issue occurs when using the **keyboard**.

### Steps to reproduce:

1. Change a value (for example, from **10** to **11** ).

2. The confirmation popup appears (see Fig. 1 , Fig. 2 , Fig. 3).

3. Press **Tab** → focus moves to **Yes**.

4. Press **Tab** again → focus moves to **No**.

5. Press **Enter** while **No** is focused.

### Actual Behavior:

Even when **No** is focused, pressing **Enter** still performs the **Yes** action, and the value changes to **11**.

### Expected Behavior:

Pressing **Enter** should trigger the button that currently has focus.  
If **No** is focused, the No action should run.

This makes keyboard navigation behave incorrectly and may cause unintended changes.

Please let me know if this is a known issue or if there is a recommended workaround.

Thank you.

Fig1: The value is 10

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/b/8/b80818c7deb57b14d67884fe35f504df630b5306.png)

Fig2: The confirmation Popup appears(Changing Value from 10 to 11)

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/e/c/ec08cb1e560dad9b7d7ec3da7465bd167c1d660e.png)

Fig3: Even when the focus is on **No** , when I press **Enter** , the value **11** is still updated.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/2/7/27b1dc80afeb673f756156149118ebede424ca26.png)

* * *

---

<div class="post-metadata">

**Author:** ![MMaynard](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mmaynard/32/3366_2.png) [@MMaynard](https://forum.inductiveautomation.com/u/MMaynard)\
**Post date:** [November 20, 2025, 12:38pm UTC](https://forum.inductiveautomation.com/t/keyboard-focus-issue-with-system-gui-confirm-popup-enter-key-always-selects-yes/112306/2 "2025-11-20T12:38:39Z")

</div>

Can you post the script you are using?

---

<div class="post-metadata">

**Author:** ![devaraj.v](https://avatars.discourse-cdn.com/v4/letter/d/ecccb3/32.png) [@devaraj.v](https://forum.inductiveautomation.com/u/devaraj.v)\
**Post date:** [November 20, 2025, 1:15pm UTC](https://forum.inductiveautomation.com/t/keyboard-focus-issue-with-system-gui-confirm-popup-enter-key-always-selects-yes/112306/3 "2025-11-20T13:15:21Z")

</div>

I am not using any custom script.  
I am only using the built-in function:

```python
system.gui.confirm(message, title, allowCancel)

```

.

---

<div class="post-metadata">

**Author:** ![dgratz](https://avatars.discourse-cdn.com/v4/letter/d/b19c9b/32.png) [@dgratz](https://forum.inductiveautomation.com/u/dgratz)\
**Post date:** [November 20, 2025, 1:26pm UTC](https://forum.inductiveautomation.com/t/keyboard-focus-issue-with-system-gui-confirm-popup-enter-key-always-selects-yes/112306/4 "2025-11-20T13:26:33Z")

</div>

I don’t know if there’s a way to change the behavior of the built-in confirmation dialog, but to achieve your desired result, you could create your own simple popup, and even parametrize it for the tag you’re changing.

If you script the yes and no buttons with a keyPressed action handler and use  
`if(event.keyCode == event.VK_ENTER):` to filter for the enter key when the button is selected, that should do the trick.

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [November 20, 2025, 1:29pm UTC](https://forum.inductiveautomation.com/t/keyboard-focus-issue-with-system-gui-confirm-popup-enter-key-always-selects-yes/112306/5 "2025-11-20T13:29:46Z")

</div>

That is default behavior for a confirmation box

Enter = Default button action (in this case, Yes)

Esc = Cancel

Space = Button action

---

<div class="post-metadata">

**Author:** ![MMaynard](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mmaynard/32/3366_2.png) [@MMaynard](https://forum.inductiveautomation.com/u/MMaynard)\
**Post date:** [November 20, 2025, 1:30pm UTC](https://forum.inductiveautomation.com/t/keyboard-focus-issue-with-system-gui-confirm-popup-enter-key-always-selects-yes/112306/6 "2025-11-20T13:30:50Z")

</div>

How are you doing the binding on the control?

Is the value of the text box bound to the actual tag? Is it bidirectional?

I am assuming you are using the key press event and turning on confirmation there and then writing to the tag?

You cannot have a bidirectional binding on the control AND use the key press event to write to it.

Can you post some screenshots of the value binding and of the configured event?

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [November 20, 2025, 1:44pm UTC](https://forum.inductiveautomation.com/t/keyboard-focus-issue-with-system-gui-confirm-popup-enter-key-always-selects-yes/112306/7 "2025-11-20T13:44:35Z")

</div>

Wrap your system.gui.confirm() call like this:

```python
from javax.swing import UIManager

UIManager.put("Button.defaultButtonFollowsFocus", True)
x = system.gui.confirm('Really?', 'Title')
UIManager.put("Button.defaultButtonFollowsFocus", False)

```

This will make the default button follow the focus.

---

<div class="post-metadata">

**Author:** ![devaraj.v](https://avatars.discourse-cdn.com/v4/letter/d/ecccb3/32.png) [@devaraj.v](https://forum.inductiveautomation.com/u/devaraj.v)\
**Post date:** [November 24, 2025, 10:11am UTC](https://forum.inductiveautomation.com/t/keyboard-focus-issue-with-system-gui-confirm-popup-enter-key-always-selects-yes/112306/8 "2025-11-24T10:11:02Z")

</div>

@JordanCClark Thank you so much! This solution worked perfectly for me and solved the issue I was struggling with. Really appreciate your help!

I need one more help from you with my code.

```python
from javax.swing import JOptionPane, UIManager

UIManager.put("Button.defaultButtonFollowsFocus", True)

choice = JOptionPane.showConfirmDialog(
    None,
    "Do you really want to continue?",
    "Title",
    JOptionPane.OK_CANCEL_OPTION
)

UIManager.put("Button.defaultButtonFollowsFocus", False)

if choice == JOptionPane.OK_OPTION:
    system.gui.messageBox("OK clicked")
elif choice == JOptionPane.CANCEL_OPTION:
    system.gui.messageBox("Cancel clicked")  

Whenever the popup opens, I don’t want the OK button to be automatically selected or focused; I want the focus to move to the buttons only when I press TAB.

```

---

<div class="post-metadata">

**Author:** ![devaraj.v](https://avatars.discourse-cdn.com/v4/letter/d/ecccb3/32.png) [@devaraj.v](https://forum.inductiveautomation.com/u/devaraj.v)\
**Post date:** [November 29, 2025, 12:50pm UTC](https://forum.inductiveautomation.com/t/keyboard-focus-issue-with-system-gui-confirm-popup-enter-key-always-selects-yes/112306/9 "2025-11-29T12:50:27Z")

</div>

Any solution to solve this problem will be appreciated  
Thank you in advance!
