Can somebody please elaborate on the difference between aria-live="assertive"
and aria-live="polite"
?
As per my understanding aria-live="assertive"
will get the higher priority and wipe off the queue, whereas aria-live="polite"
is having low priority over aria-live="assertive"
and will continue with queue.
The behavior of live regions depends on the browser and screen reader being used, but you're on the right track.
According to the WAI-ARIA spec:
The values of this attribute are expressed in degrees of importance. When regions are specified as polite, assistive technologies will notify users of updates but generally do not interrupt the current task, and updates take low priority. When regions are specified as assertive, assistive technologies will immediately notify the user, and could potentially clear the speech queue of previous updates.
Usage notes from the WAI-ARIA authoring practices 1.1:
aria-live="polite"
Any updates made to this region should only be announced if the user is not currently doing anything. live="polite" should be used in most situations involving live regions that present new information to users, such as updating news headlines. -
aria-live="assertive"
Any updates made to this region are important enough to be announced to the user as soon as possible, but it is not necessary to immediately interrupt the user. live="assertive" must be used if there is information that a user must know about right away, for example, warning messages in a form that does validation on the fly.
Regarding clearing the queue (also from the spec):
User agents or assistive technologies MAY choose to clear queued changes when an assertive change occurs.