There is a check in the source that ignores active_window_changed events, if the new active window is not visible. This is on purpose, of course, but IMHO misguided. A window manager may set the "active window" property before the "current desktop" one when switching desktops. That leads to the tasklist not showing any window as active after the switch.
Created attachment 4742 Patch
-- GitLab Migration Automatic Message -- This bug has been migrated to xfce.org's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.xfce.org/xfce/xfce4-panel/-/issues/47. Please create an account or use an existing account on one of our supported OAuth providers. If you want to fork to submit patches and merge requests please continue reading here: https://docs.xfce.org/contribute/dev/git/start#gitlab_forks_and_merge_requests Also feel free to reach out to us on the mailing list https://mail.xfce.org/mailman/listinfo/xfce4-dev