Problem/Motivation
When you use 'announce' => '' option, passed to MessageCommand ajax command, it's not supposed to announce the message, and while it doesn't announce the substance of the message, it does announce 'Warning message'.
Video: This video doesn't have audio, but you can see the messages from VoiceOver in the modal with a black background and white text. This video was made testing in Safari with VoiceOver.
https://www.drupal.org/files/issues/2019-10-24/no-announce-announcing.mov
Screenshot from the video:

Proposed resolution
role='alert' shouldn't be added to error and warning messages if options.announce is an empty string.
Remaining tasks
review/commit.
User interface changes
API changes
Data model changes
Release notes snippet
Comments
Comment #2
oknateComment #3
oknateComment #4
oknateComment #5
oknateComment #6
andrewmacpherson commentedNice catch. Silent movies with the VoiceOver caption window are good.
Comment #7
oknateThanks!
Note, I'm not sure if this is a bug with MessageCommand, or Drupal.announce yet. I'll investigate.
Comment #8
oknateHere's a patch for this. It requires manual testing.
Testing instructions:
/core/modules/system/tests/modules/ajax_testto/modules/Comment #9
oknateComment #10
bnjmnmI am pleased to be able to mention that it is possible to run test modules without copying them to another directory. Add
$settings['extension_discovery_scan_tests'] = TRUE;to settings.php.MessageCommandTestto confirm the message wrapper doesn't have a role attribute is empty when MessageCommand with'announce' => ''is executed, and of course add that test to the main patch as well.Provide a comment explaining why the role isn't set on an empty string (this can be deduced from the param description, but would be good to have here to mitigate future dev confusion)
While testing this I also noticed that most messages are read twice because they are sent to announce via add(), after which they are added to an element with an ARIA role defined. This usually doesn't happen with 'alert' as the alert kicks out the other attempt to announce the message, but I can make those occur twice in some instances with a throttled network connection. This will need a followup issue.
Comment #11
oknateAddressing #10
1. Thanks! I'll remember that.
2. ✅Added test coverage and FAIL patch.
4. ✅Added comment explaining why we're removing role when announce set to an empty string.
Also, I added a follow-up for the duplicate reading: #3090371: Drupal.Message.add passing messages to Drupal.announce is usually redundant
Comment #13
bnjmnmUbernit: there should only be one space separating the sentences.
Other than that, I think the changes are good. I added the tag "needs subsystem maintainer" since this modifies Drupal.message a bit. Not sure which jurisdiction this is, but I know @lauriii was active in the initial development of the JS messages API.
Comment #14
oknateFixing nit in #13 about two spaces between sentences in the comment.
Comment #15
john cook commentedI've tried to test this manually.
There are some extra buttons in the video that aren't in the test module. May be the extra buttons need to be added as well?
Clicking the "Make Warning Message" button still announces "Warning message I am a warning message in the default location." From the description and test instructions from comment #8, I don't think that this is intended

Setting back to needs work.