Skip to content

Commit

Permalink
MDL-75055 templates: Apply the .alert-dismissible class
Browse files Browse the repository at this point in the history
- 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.
  • Loading branch information
junpataleta committed Jun 29, 2022
1 parent 3ce2cde commit 453c3ac
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/templates/notification_base.mustache
Expand Up @@ -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 }}{{!
Expand Down

0 comments on commit 453c3ac

Please sign in to comment.