Screen readers like NVDA fire synthetic click events on the <img> child of the button rather than on the thumbnailImageContainer element itself, so the strict classList.contains check silently failed.