GeopJr / Tuba

Browse the Fediverse
https://tuba.geopjr.dev/
GNU General Public License v3.0
506 stars 55 forks source link

fix(RichLabel): link focus #950

Closed GeopJr closed 3 weeks ago

GeopJr commented 1 month ago

Found while debugging a bug posted on Matrix:

In the 0.7 release, we introduced better keyboard navigation by remembering the last focused widget before showing a new timeline, and re-focusing when returning back. That way people using keyboard navigation won't have to start from the top.

GtkLabel is responsible for its links / we don't have access to them, not as widgets. That meant that it's also responsible for their focus, and clicking one of those links (notice: with a pointer device, not keyboard - that way it hasn't been in focus) wouldn't set it as focused and therefore when you went back to the previous timeline, it would start at the top.

Since timelines can only change when activating one of those links, the solution is to grab focus before handling the link. That way the previous timeline has the chance to update its last widget.