Make mod search box text be selected when a new mod is selected/deselected
Addresses #26142.
This makes the SelectAll() method from SearchTextBox be triggered when the mod selection is changed and the search box is focused.
I'm just not sure if it's bad practice to include the method trigger for SelectAll() inside the mod selection update method. As such, I've made a second branch in which the SelectAll() method is triggered when the select key is pressed. If this PR gets rejected due to it, I'll continue to work on the second branch and try to include a trigger for when a mod is clicked.
I'm not sure why this "addresses" the linked discussion if it does not implement its suggestion. The suggestion was to clear the text box, not to select all text in it.
Additionally I'm unsure about doing it on every change of mods. I'd say it should only happen after an "enter" press for the "automatic select first matching" feature.
I'm not sure why this "addresses" the linked discussion if it does not implement its suggestion. The suggestion was to clear the text box, not to select all text in it.
As for that, I think the main issue reported by the discussion was that you should be able to just type the name for a new mod instead of manually clearing the search term. Immediately clearing the text box could be unexpected to some players, especially in cases where you want to select more than one mod based on that search term. So I implemented it by selecting the text in the text box, since it should basically do the same thing: allow the player to continue typing the name of new mods after a applying a mod. I don't know if this should have been discussed before the PR. If so, I'm sorry.
Additionally I'm unsure about doing it on every change of mods. I'd say it should only happen after an "enter" press for the "automatic select first matching" feature.
As for only doing it after pressing "enter", it's what my second branch do. I implemented it for every mod selection change, because that's a simple way I found of doing it if the player clicked the mod instead of applying by using the keyboard. If this is unnecessary, I can use the second branch.
Do I make another PR or do I just force-push to this?
Do I make another PR or do I just force-push to this?
No need to do either, just commit new commits to this branch please.
I think selecting all rather than deleting the text is probably fine, too.
Now it only triggers SelectAll() when pressing enter. I could try to implement that for selecting mods with clicking too, but I don't know if this is out of scope and I don't know much how I would do that without messing with the updateFromInternalSelection method.