Repeat until X is Enabled Function no longer working on Big Sur AppleScript

Has anyone else noticed that the Repeat until X is Enabled function is no longer working on AppleScript Mac OS Big Sur?

Has anyone been able to overcome this issue? If so, how?

Many thanks.

activate application "Mail"
tell application "System Events"
   tell process "Mail"
      repeat until button 1 of toolbar 1 of window 1 is enabled
      end repeat
      click button 1 of toolbar 1 of window 1
   end tell
end tell