This is something that I have been able to find almost no information on (two posts on reddit and stack exchange with no resolutions).
Normally, I would expect to be able to press alt+tab, when sort order is set to recently used, and it will switch to the last window I had open. But, on my setup when I press alt+tab it switches to some seemingly random window and the same when I try to cycle through all windows. There may be some sort of order to it but I can’t see it and it definitely is not in the most recently used order. What I am trying to get is something like MS Win (sorry) alt+tab. I often have to cut/switch window/paste and then go back and do so again but with this its a better use of time to just use my mouse (ugh) and click… better use of time being all relative as its a down right PITA.
I have discovered that if I set it to “current desktop” under virtual desktops it works fine (caveat being that is not what I need), but if I set it to “all other desktops” then it just seems to start selecting windows in virtual desktops randomly.
Does anyone know about this issue or how to resolve it? Please 
For what its worth I am using v5.18.5
Are you using the “Slide Back” KWin effect?
Thanks for the response! So it seems yes (I guess it was a default as i don’t remember setting it). I tried to turn it off then alt+tabbing again but it still seems random in its selection of which window/desktop it switches to?
In that case I’m pretty sure it’s a known bug: 455429 – kwin sometimes composes windows in the wrong order when using the Slide Back effect.
As a workaround, you can disable the Slide Back effect.
I’m pretty sure it’s not enabled by default… at least not in KDE code. Maybe your distro enables it by default? If so they should be aware of this bug, and they should either disable it by default until it’s fixed, or contribute engineering resources towards fixing it.
Thanks again for that. Just to make sure we are talking about the same option, this is the slide/slideback effect under Settings > Workspace Behavior > Desktop effects?
I ask because I tried to disable both slide back under “focus” and “slide” under Virtual Desktop Switching and it still appears to be an issue? I also tried the set defaults option and it seems that “slide back” under Focus is indeed disabled but “slide” under Virtual Desktops is enabled be default? (regardless, default or not I am still getting random desktops). I will try rebooting once a process I have running finishes and see if that helps (I of course “applied” changes but maybe needs a reboot as well?)
Hmm, if that’s not it then something else may be going on.
For what its worth, I am experiencing this on a new computer, I had the same issue with my previous computer
Any other thoughts on what this might be? Might there be some indication in a log somewhere? or a possible work around?