MDL-75055 templates: Apply the .alert-dismissible class

- Apply the .alert-dismissible class for notification alerts with
close button to fix its positioning. As an added bonus, the
.alert-dismissible class also enlarges the clickable area of the
close button which is great for accessibility.
- Improve example context for the notification alerts templates.
This commit is contained in:
Jun Pataleta 2022-06-23 14:43:50 +08:00
parent 3ce2cde773
commit 453c3ac47d

View File

@ -34,9 +34,14 @@
* announce Whether the notification should be announced to screen readers.
Example context (json):
{ "message": "Your pants are on fire!", "closebutton": 1, "announce": 1, "extraclasses": "foo bar"}
{
"message": "<p>Hello <a href=\"#\">World!</a></p><p>Your pants are on fire!</p>",
"closebutton": 1,
"announce": 1,
"extraclasses": "foo bar"
}
}}
<div class="alert {{$alertclass}}alert-secondary{{/alertclass}} alert-block fade in {{ extraclasses }}" {{!
<div class="alert {{$alertclass}}alert-secondary{{/alertclass}} alert-block fade in {{ extraclasses }} {{#closebutton}}alert-dismissible{{/closebutton}}" {{!
}}{{# announce }} role="alert" data-aria-autofocus="true"{{/ announce }}>
{{{ message }}}
{{# closebutton }}{{!