renpy icon indicating copy to clipboard operation
renpy copied to clipboard

default_focus is not respected when showing a screen from another screen

Open javascript-error opened this issue 4 years ago • 2 comments

When a screen contains a button that shows another screen, and the second screen has higher priority set via the default_focus attribute, focus is not transferred to the second screen.

Minimal example:

screen midmenu():
    textbutton "Start" default_focus 10 action Start() xpos 250


screen main_menu():
    textbutton "Get It Started" default_focus 9 action Show("midmenu")

javascript-error avatar Jul 15 '22 13:07 javascript-error

I've fixed this, I believe. The new commit only invokes the default_focus behavior if the last event was not mouse or touch-based - that is, if the interaction was restarted using the keyboard, gamepad, or something more esoteric like a timer. That change prevented fighting between default_focus and the mouse focus system invoked in the next frame.

renpytom avatar Jul 25 '22 01:07 renpytom

Happened again on 8.1.1, although my screen is more complex than that. Will need to make a minimal screen for repro, but will do after jam.

hsandt avatar Jun 26 '23 12:06 hsandt