Skip to content
This repository has been archived by the owner on Sep 5, 2024. It is now read-only.

WIP: Accessible Dialog #222

Closed
wants to merge 1 commit into from
Closed

WIP: Accessible Dialog #222

wants to merge 1 commit into from

Conversation

marcysutton
Copy link
Contributor

To make material-dialog accessible, focus must be handled to guide assistive tech and keyboard users through the interface. When the dialog opens, focus is sent from the "Open a Dialog" button to the "Okay" / close button. When the dialog closes, focus should be sent back to the original target element (still to be implemented). As part of this change, tabIndex="-1" and a focus() listener was added to material-button so that focus could be dynamically sent to the innerElement (a native button or anchor element).

@ajoslin
Copy link
Contributor

ajoslin commented Aug 30, 2014

Merged via 8f756fc, with a few changes:

  • If no element with class dialog-close is found, it will focus the last button within the .dialog-actions element.
  • Added a note to the documentation saying this.
  • Added one unit test for each case: it should focus the .dialog-close element and it should focus the last button.
  • Added a TestUtil.mockElementFocus() function, which mocks angular.element.prototype.focus for the duration of one test to set $document.activeElement, so we can actually figure out what got focused in a unit test.

@marcysutton
Copy link
Contributor Author

I think we need to revisit this–focus is not returned to the triggering element when the dialog is closed.

@marcysutton marcysutton deleted the wip-accessible-dialog branch September 2, 2014 21:49
kashyapkaki pushed a commit to kashyapkaki/material that referenced this pull request May 10, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
a11y This issue is related to accessibility type: enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants