• John Lee's avatar
    WebUI: Fix toasts not reading out content · c59cda92
    John Lee authored
    Messaging in cr-toasts were not being read out consistently, especially
    in cases where the toast text stays the same for multiple actions (for
    example, "Bookmark removed." for multiple different bookmarks).
    
    This CL updates the cr-toast's show method to remove the role="alert"
    attribute and re-add it to better ensure screen readers recognize to
    read out the cr-toast's contents, and fixes one use of cr-toast to use
    the show method instead of data-binding a property as the open
    attribute.
    
    Using a method is better than using an attribute because each call to
    the method is a signal to read out the cr-toast, while using an
    attribute will not trigger for any toasts that are shown while a toast
    is already visible. For example, setting |open| to true while it is
    already set to true will not trigger any JS, but calling |show()| is
    guaranteed to always trigger the method's contents.
    
    The plan is to replace all uses of the open attribute to the show method
    for better consistency, and to eventually change the open property on
    cr-toast to read-only.
    
    Previous params for show were not being used.
    
    Fixed: 1055842
    Change-Id: I6c545814a4fc4b465b35708abbfa746c4acbb69a
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2477663
    Commit-Queue: John Lee <johntlee@chromium.org>
    Reviewed-by: default avatardpapad <dpapad@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#818616}
    c59cda92
personalization_options.js 5.86 KB