Skip to content

Conversation

@michaelvdow
Copy link

This pull request adds accessibility features based on the work done in #133 by converting it from CoffeeScript to vanilla JS. This prevents focus from leaving the dialog while tabbing, and hides the main content when the dialog is visible. Upon dialog close, focus is given back to element with initial focus.
It also adds requested changes from #26 that change the exit button to a <button> and added aria-labels.

src/vex.js Outdated
closeAllOnPopState: true,
giveBackFocus: true,
trapTabKey: true,
ariaContentMain: 'body:not([vex])'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the original PR, this selector was 'body > :not(.vex)'. The selector you have selects a very different thing. What's the reason for the change?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ariaContentMain was changed back to the correct selector

src/vex.js Outdated
// Close button
if (options.showCloseButton) {
var closeEl = vexInstance.closeEl = document.createElement('div')
var closeEl = vexInstance.closeEl = document.createElement('button')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a sanity check on our CSS, does this break any styles?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This changed the appearance of several styles so it was changed back to div

src/vex.js Outdated

//Tab key pressed
if (event.which == 9) {
console.log(focusableElements.length)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keep console.log's out of production code.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Conole.log's have been removed

src/vex.js Outdated
event.preventDefault()
}
} else {
console.log("tab overrided")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keep console.log's out of production code.

@bbatliner
Copy link
Contributor

@michaelvdow: see my specific comments on the code, but otherwise very good stuff. Can you run npm run test from the project directory? This will run our linter, which will enforce a consistent style and catch some mistakes you may have made. Please fix any errors that come up on there.

@bbatliner
Copy link
Contributor

Hey @huoxito! Someone got around to porting your accessibility PR to vanilla JS and I want you to take a look before we merge it in. Can I have your feedback/approval? :D

@huoxito
Copy link

huoxito commented Feb 26, 2018

nice work @michaelvdow and thanks for getting in touch @bbatliner LGTM 🚢

@felixhaeberle
Copy link

@bbatliner @huoxito Any updates on this? Considering implementing this in the new Drupal Admin UI Theme "Claro" if this accessibility features gets added.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants