I tried the dummy code with NVDA V2024.4.2.35031 and Chrome V134.0.6998.89 and everything worked, it seems your problem is due to a browser or screen reader issue. As you stated in the comment's the problem was due to the browser being outdated.