Hi,
As i was facing the same issue with my Hp Victus laptop. When i completely formatted my pc, i got the same issue that whenever i click on shut down, its display and fans gets off but my keyboard and external mouse still on.
after doing hit and trial like reset for 3-4 times from cloud or locally, installing display drivers, Nvidia's drivers and all stuff, i went to AMD's website and searched for latest AMD driver, as i have AMD Ryzen 5600H, NVIDIA RTX 3050, and It Worked!!