wesnoth / wesnoth

An open source, turn-based strategy game with a high fantasy theme.
https://www.wesnoth.org/
GNU General Public License v2.0
5.51k stars 1.02k forks source link

GUI2: Tab order is broken #9443

Closed babaissarkar closed 1 week ago

babaissarkar commented 1 week ago

Game and System Information

Description of the bug

Pressing Tab moves focus to the wrong widget in tab order. Same with Shift+Tab

Steps to reproduce the behavior

  1. Open Map Editor > New Scenario > Create > Edit Scenario Settings
  2. Click on the text box beside the Identifier: label
  3. Press Tab
  4. Focus goes to the text box beside Description: instead of the text box beside Name:.

This is just an example and the problem happens also with any dialog that has tab ordered text boxes, such as the Time Schedule Editor. Also happens with Shift+Tab.

Expected behavior

Focus should go to the Name textbox, in other word, the one next in the tab order when Tab is pressed. Similarly should go the previous textbox in tab order when Shift+Tab is pressed, which is the Description textbox in this case.

Additional context

Debugging shows that the handler here is related: https://github.com/wesnoth/wesnoth/blob/36146c5c6c48b44c79d0bf4bbfcbd9886f68525a/src/gui/widgets/window.cpp#L1287

Wedge009 commented 1 week ago

This reminded me of #1239 - this is the first place I've seen that actually seems to allow for switching using Tab...

Vultraz commented 1 week ago

Adding some context from Discord. @babaissarkar debugged and discovered this was due to a handler being called twice on tab down, resulting in the skip-to-next-widget code being called twice.