Skip to content

Commit

Permalink
MDL-74802 core: Improve the accessibility of alert notifications
Browse files Browse the repository at this point in the history
* Make the ordering of the message and the close button logical on
  the DOM.
* Hide the times HTML entity
* Add sr-only label on the close button for non-sighted users
* Add tooltip on the close button sighted users
  • Loading branch information
junpataleta committed May 23, 2022
1 parent 2affa30 commit a7db400
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 5 deletions.
8 changes: 7 additions & 1 deletion lib/templates/notification_error.mustache
Expand Up @@ -39,6 +39,12 @@
<div class="alert alert-danger alert-block fade in {{ extraclasses }}" {{!
}}{{# announce }} role="alert" data-aria-autofocus="true"{{/ announce }}{{!
}}>
{{# closebutton }}<button type="button" class="close" data-dismiss="alert">&times;</button>{{/ closebutton }}
{{{ message }}}
{{# closebutton }}{{!
}}<button type="button" class="close" data-dismiss="alert"{{!
}} title="{{#str}}dismissnotification, core{{/str}}" data-toggle="tooltip">
<span aria-hidden="true">&times;</span>
<span class="sr-only">{{#str}}dismissnotification, core{{/str}}</span>
</button>{{!
}}{{/ closebutton }}
</div>
9 changes: 7 additions & 2 deletions lib/templates/notification_info.mustache
Expand Up @@ -39,7 +39,12 @@
<div class="alert alert-info alert-block fade in {{ extraclasses }}" {{!
}}{{# announce }} role="alert" data-aria-autofocus="true"{{/ announce }}{{!
}}>
{{# closebutton }}<button type="button" class="close" data-dismiss="alert">&times;</button>{{/ closebutton }}
{{{ message }}}
{{# closebutton }}{{!
}}<button type="button" class="close" data-dismiss="alert"{{!
}} title="{{#str}}dismissnotification, core{{/str}}" data-toggle="tooltip">
<span aria-hidden="true">&times;</span>
<span class="sr-only">{{#str}}dismissnotification, core{{/str}}</span>
</button>{{!
}}{{/ closebutton }}
</div>

8 changes: 7 additions & 1 deletion lib/templates/notification_success.mustache
Expand Up @@ -39,6 +39,12 @@
<div class="alert alert-success alert-block fade in {{ extraclasses }}" {{!
}}{{# announce }} role="alert" data-aria-autofocus="true"{{/ announce }}{{!
}}>
{{# closebutton }}<button type="button" class="close" data-dismiss="alert">&times;</button>{{/ closebutton }}
{{{ message }}}
{{# closebutton }}{{!
}}<button type="button" class="close" data-dismiss="alert"{{!
}} title="{{#str}}dismissnotification, core{{/str}}" data-toggle="tooltip">
<span aria-hidden="true">&times;</span>
<span class="sr-only">{{#str}}dismissnotification, core{{/str}}</span>
</button>{{!
}}{{/ closebutton }}
</div>
8 changes: 7 additions & 1 deletion lib/templates/notification_warning.mustache
Expand Up @@ -39,6 +39,12 @@
<div class="alert alert-warning alert-block fade in {{ extraclasses }}" {{!
}}{{# announce }} role="alert" data-aria-autofocus="true"{{/ announce }}{{!
}}>
{{# closebutton }}<button type="button" class="close" data-dismiss="alert">&times;</button>{{/ closebutton }}
{{{ message }}}
{{# closebutton }}{{!
}}<button type="button" class="close" data-dismiss="alert"{{!
}} title="{{#str}}dismissnotification, core{{/str}}" data-toggle="tooltip">
<span aria-hidden="true">&times;</span>
<span class="sr-only">{{#str}}dismissnotification, core{{/str}}</span>
</button>{{!
}}{{/ closebutton }}
</div>

0 comments on commit a7db400

Please sign in to comment.