Skip to content

Commit

Permalink
add an aria-label to avoid the dialog content being read twice
Browse files Browse the repository at this point in the history
Without an `aria-label` screen readers (NVDA, JAWS, VoiceOver) read the dialog content twice: once as a title and another time as the content.

Depends on vaadin/vaadin-dialog#91
Fixes #29
  • Loading branch information
Viktor Lukashov committed Jul 23, 2018
1 parent 17da0d0 commit 412eeb7
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/vaadin-confirm-dialog.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,12 @@
display: none;
}
</style>
<vaadin-dialog id="dialog" opened="{{opened}}" no-close-on-outside-click no-close-on-esc>
<vaadin-dialog
id="dialog"
opened="{{opened}}"
aria-label="[[_getAriaLabel(header)]]"
no-close-on-outside-click
no-close-on-esc>
<template>
<div part="header">
<slot name="header">
Expand Down Expand Up @@ -99,7 +104,8 @@ <h3 class="header">[[header]]</h3>
* Set the confirmation dialog title.
*/
header: {
type: String
type: String,
value: ""
},
/**
* Set the message or confirmation question.
Expand Down Expand Up @@ -216,6 +222,10 @@ <h3 class="header">[[header]]</h3>
this.dispatchEvent(new CustomEvent('reject'));
this.opened = false;
}

_getAriaLabel(header) {
return header || "confirmation";
}
}

customElements.define(ConfirmDialogElement.is, ConfirmDialogElement);
Expand Down

0 comments on commit 412eeb7

Please sign in to comment.