-
Notifications
You must be signed in to change notification settings - Fork 183
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
At the opening of the modal the focus should be initially set on the first focusable element. #103
Comments
Thanks for raising this ticket, and apologies about the delayed reply. If you have information to reinforce why you believe it should be X or Y, we're open to reading more and making an informed decision to improve Modaal. For now, we'll mark this as an enhancement and gauge public interest in whether this is a desired feature or not before investing too much time developing something that will not be often used. |
The W3C's WAI-ARIA Authoring Practices 1.1 provide a set of criteria for building various common UX patterns. The Dialog (Modal) pattern has these notes attached to it:
and
Currently Modaal contains Scenario 1Their Date Picker demo launches a modal containing a grid of dates. On launch of the modal, the focus is put on the current day's date: Scenario 2In my use case today, I have a faux video 'play' button which launches an Ajax Modaal via click/tap/ENTER/SPACE. If ENTER/SPACE was used, I'd like an additional press of ENTER/SPACE to play the video, without the user having to locate the button first. WorkaroundI have implemented this pattern in the past, focussing a search field on before_open: function () {
var id = this.scope.id;
setTimeout(function () {
var $modal = $('#' + id);
var $autofocus = $modal.find('[data-js-autofocus-modal]');
if ($autofocus.length) {
$autofocus.eq(0).focus();
}
}, 500);
} |
The focus should be on a link, or on a form element or on the Close button. The ability to set this would be nice.
Thanks
The text was updated successfully, but these errors were encountered: