Skip to content

GUI-box steals keyboard focus #2568

@Brainsample

Description

@Brainsample

After updating from kOS 1.1.5.2, I ran into an awkward problem.
Spawning, or clicking on a GUI-box sets keyboard focus to that box.
The keyboard can only be used again by left clicking in-world first.
For some reason, a few keys like C, V and Arrows are exceptions.

=======

Test ship:

  • Probe core.
  • Battery.
  • Scriptable control system.

Test script:

local g IS GUI(180).
set g:skin:button:width to 80.
local b1 IS g:addbutton("test").
g:show().

local keyboard_input is terminal:input:getchar().
until keyboard_input = "-"
{
	print keyboard_input.
	wait 0.0001.
	set keyboard_input to terminal:input:getchar().
}

clearguis().

Repro:

  • Launch the ship, run the script.
  • Use the keyboard.

Observe 1.1.5.2: All keystrokes are passed on to the world, as expected.
Observe 1.1.6.0 and later: The GUI-box has keyboard focus, all keystrokes are lost.

  • Click in-world.
  • Click (not drag) the GUI-box.
  • Use the keyboard.

Observe: Same results.
Expected: A GUI-box only has keyboard focus when it has an active text-entry field.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions