Skip to content

Commit

Permalink
chore: use optional chaining
Browse files Browse the repository at this point in the history
  • Loading branch information
mxmason committed Jul 7, 2022
1 parent aa493b0 commit 7b6d6d6
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions src/a11y-dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,13 +123,7 @@ export default class A11yDialog {

this.shown = false
this.$el.setAttribute('aria-hidden', 'true')

// If there was a focused element before the dialog was opened (and it has a
// `focus` method), restore the focus back to it
// See: https://github.com/KittyGiraudel/a11y-dialog/issues/108
if (this.previouslyFocused && this.previouslyFocused.focus) {
this.previouslyFocused.focus()
}
this.previouslyFocused?.focus?.()

// Remove the focus event listener to the body element and stop listening
// for specific key presses
Expand Down

0 comments on commit 7b6d6d6

Please sign in to comment.