Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filter string in station window breaks flow in user interface #8875

Closed
Kuhnovic opened this issue Mar 19, 2021 · 4 comments
Closed

Filter string in station window breaks flow in user interface #8875

Kuhnovic opened this issue Mar 19, 2021 · 4 comments

Comments

@Kuhnovic
Copy link
Contributor

@Kuhnovic Kuhnovic commented Mar 19, 2021

Version of OpenTTD

1.11.0 RC 1

Expected result

The newly created filter string feature ( #8706 ) should not interfere with the functionality of the hotkeys

Actual result

The filter string textbox automatically gets the focus. This interrupts the common workflow, since you can no longer use hotkeys (i.e. R or DEL), because they now modify the filter string instead of doing what they are supposed to do. It's now impossible to remove a station tile by pressing R when the build-station-window is open, you have to use the bulldozer button.

Steps to reproduce

  • Click the Build Railway button (or press A)
  • Click the Build Station button in the rail toolbar
  • Hit R. Instead of going into "remove station tile mode", and r is added to the filter string
  • Hit DEL. You would expect all windows to close, but instead the filter string is modified and the windows stay open.

The Town Directory window has a similar filter textbox, but it does not automatically get the focus, and that works just fine. Removing the auto focus on the text field will probably fix the issue.

@stormcone
Copy link
Contributor

@stormcone stormcone commented Mar 19, 2021

If you press the ESC, the focus is lost and you can use the hotkeys.

@Kuhnovic
Copy link
Contributor Author

@Kuhnovic Kuhnovic commented Mar 19, 2021

That does work indeed, thanks. But it still feels counter intuitive.

@perezdidac
Copy link
Contributor

@perezdidac perezdidac commented Mar 22, 2021

To solve the issue it's just about removing one line of code in rail_gui.cpp:

this->SetFocusedWidget(WID_BRAS_FILTER_EDITBOX);

However, what should we do here ideally? Let people jump into being able to filter or keep using the hotkeys? Note that the filter doesn't show if no NewGRF with stations are loaded.

@nielsmh
Copy link
Contributor

@nielsmh nielsmh commented Mar 22, 2021

Don't break people's workflows by stealing the hotkeys.
(Idea for a better approach: Have a hotkey that puts keyboard focus to the filter-search box of the last opened window, if any. That would obviously need to work with all windows that have filter-search boxes.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants