Why does a click in button set currentSelectedGameObject to Null?

I always expected a button to set EventSystem.current.currentSelectedGameObject to the Button components GameObject, but it turns out, this is not the case. The currentSelectedGameObject instantly changes to null.
I really need to be able to react on a button becoming selected and the brute force way was to add an Update method and compare the change of the value with the new one. In theory, I should then be able to read the new selection from the EventSystem, but no, it looses all selection information. This leaves me without a determinated status.
Do I miss here something in understanding and how am I supposed to track the change of selection? I am not able to use a custom object derived from Selectable, it needs to be the builtin Button class as the requirement.

How are you “selecting” that button? If you click on it, that will trigger its pressed state actions, not sure if that should act as “button is selected”. Selection happens through navigation, for instance via Tab, cursor keys, or similar. Maybe try that to see if the behaviour differs in that case.

The button may also have a checkbox “selectable” or “allow selection” or something to that effect because you may not want every button to be selectable through navigation.

By clicking it, just that. I would expect the navigation logic to set the most recently clicked button to be the selected one, everything else doesn’t make sense for me. Why should the controller “jump back” to another button, if I clicked the new button already.
Regarding the navigation, that is exactly the background here. I have an own traversal logic, as I decoupled this from the actual EventSystem implementation to be able to switch UIs (I use UGUI and Rive from project to project and plan to use UI Toolkit for runtime sometime as well, but don’t want to switch the command structure). Now I need some feedback from UGUI, if the selected GameObject changed by the usage of the mouse to sync back into my own traversal system.

Well, it doesn’t. Selection becomes null. Probably because the instant you “select” the button it “clicks”, fires its events, and returns to the “unclicked” state - it doesn’t get or remain selected by clicking it because that action of clicking a button is not a selection.

Though granted in Windows it works a bit differently where you can see a dashed outline for the selection, which can be around buttons too.

You could subclass button and use only the subclass. Your subclass would use the “on release” event to also assign itself as the selected element - provided that is possible.

As I said, I can’t at that point and don’t want to. Because then I can use fully custom implemented buttons anyway, if the provided controls lack even the most basic functionality. Where is the point to use something that basic and have to implement everything yourself in the end anyway? Professional software development is really something different.