I guess rebuilding against python 3.12 wouldn't help, as Ubuntu Noble 24.04 gets shipped with python 3.12 and has the issue as well. (Though maybe it's still worth to have a closer look, maybe something else is not up to date.)
Some of the issue reports mention a work around: Onboard Settings -> Keyboard -> tab Advanced -> Input event source: Change from "Xinput" to "GTK". For me, tried on Xfce4, this avoids onboard to crash, but causes other strange behavior instead (e.g. keys being stuck).
In the first Ubuntu link, in the first comment, there is a reference to a possible patch (link below). Further down in the Ubuntu issue the comment No. 11 says that the patch didn't solve the problem.
In Debian, some work on patches have been done (from Jun 24, 2024 to Jul 10, 2024) but as far as I can see they are not related to the issue. However, the issue was now reported to the Debian bug tracker, causing investigations on this:
For Fedora there is a bug report at Red Hat. There is a proposed patch in comment No. 30. I'm not familiar with the package building at Fedora but it looks to me like "onboard" was removed after Fedora 39 with comment "Orphaned for 6+ weeks", likely due to unmaintained upstream onboard repository.
The proposed patch at Fedora / Red Hat bug No. 2227390 seems to be the same like the one I mentioned further up, which is in the Ubuntu bug No. 2063041 in its first comment:
Whereas the patches proposed in the Arch Linux issue No. 2 mentioned above, the first one goes into a similar direction but the second patch seems to do something else.
As the upstream onboard repository is unmaintained, we'll need to add a patch to Alpine Linux packaging.
There is no issue report on this in Alpine yet.
Unfortunately, I'm short on capacity and time since a while already.
Basically a backtrace of the crash should be done. However, some of the other issue reports already contain one. Therefore we maybe can skip this step.
Testing the different proposed patches mentioned above would be worthwhile. The one mentioned in Ubuntu / Fedora / Red Hat looks preferable. I'd say the two patches proposed in Arch Linux would be second choice. If one of those patches solves the issue, it could be added to Alpine Linux via a merge request. Maybe it would also be worth waiting to see how the issue is going to be solved in Debian, not sure how long it will take. Supporting the Debian issue by e.g. providing hints to the proposed patches might speed it up, unfortunately I'm not familiar with Debian bug reporting system und currently don't have the time to do that.
On the postmarketOS wiki I added a note to the user interfaces Xfce4, MATE and LXQt pointing to this issue report here.
There are two temporary work arounds, which both look not very satisfying to me:
As mentioned further up and in some of the issue reports: Onboard Settings -> Keyboard -> tab Advanced -> Input event source: Change from "Xinput" to "GTK". For me this caused some other issues in behavior (sticking keys). Also I guess this doesn't apply to the lock screen and (if disabling autologin) at LightDM login screen.
Moving to another virtual keyboard until the issue is solved. The easiest possibility is likely "matchbox-keyboard", though it's not as nice as "onboard". After installation, it would need to be added to the autostart applications. For lock screen and LighDM login screen it needs to be used in embedded mode matchbox-keyboard --xid. The wiki pages of Xfce4 and MATE explain in section "Lock screen" how to change the lock screen keyboard. In LXQt it's currently the same like in Xfce4. For LightDM login screen (if autologin is disabled) I'm not fully sure, it should roughly work with greeter "lightdm-gtk-greeter" setting keyboard=matchbox-keyboard --xid in "/etc/lightdm/lightdm-gtk-greeter.conf", see wiki page "Display manager" (edit: without the "keyboard-position" option, this doesn't work with "matchbox-keyboard" as far as I know).
I think that patch would be more preferable to submit to Alpine Linux. The one from Void Linux would be a patchset consisting of 2 patches, whereas we seem to need only the first one of it (which makes things more complicated to discusss). Also it slightly changes the structure of an error return at the beginning (with the same result, still a bit intruding). The patch proposed in the Ubuntu issue (and Fedora / Red Hat issue) looks more clear and consistent to me.
Though, as long as it works, I'm also fine with the Void Linux patch.
I now also had a try with the patch (on LXQt but that shouldn't matter). onboard doesn't crash anymore. However, I have issues with special characters like -, /, etc. When hitting those keys, they get "stuck" and the character doesn't get printed.
For comparison I also tried with the Void Linux patch. It doesn't make a difference, the behavior is the same.
I observed that sticking keys behavior also without patch when trying the workaround changing the "Input event source" from "Xinput" to "GTK" in the onboard settings (see further above). Thus, that sticking keys issue might be a separate issue with another cause. It will need further investigation.
The MR at Alpine should be continued. It prevents onboard from crashing, which improves the situation by a lot already. This will also ease the further investigation on the sticking keys issue.