Skip to content

Commit 0785cc6

Browse files
committed
Rename setActive -> setFocus
1 parent 74547e1 commit 0785cc6

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

assets/js/hooks/dropdown.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,15 +81,15 @@ export default {
8181
const items = this.getAllMenuItems()
8282
const currentIndex = this.getCurrentFocusIndex(items)
8383
const targetIndex = currentIndex === 0 ? items.length - 1 : currentIndex - 1
84-
this.setActive(items[targetIndex])
84+
this.setFocus(items[targetIndex])
8585
},
8686

8787
navigateDown(e) {
8888
e.preventDefault()
8989
const items = this.getAllMenuItems()
9090
const currentIndex = this.getCurrentFocusIndex(items)
9191
const targetIndex = currentIndex === items.length - 1 ? 0 : currentIndex + 1
92-
this.setActive(items[targetIndex])
92+
this.setFocus(items[targetIndex])
9393
},
9494

9595
handleEscape() {
@@ -107,7 +107,7 @@ export default {
107107

108108
handleMouseOver(e) {
109109
if (e.target.getAttribute('role') === 'menuitem') {
110-
this.setActive(e.target)
110+
this.setFocus(e.target)
111111
}
112112
},
113113

@@ -129,7 +129,7 @@ export default {
129129
return Array.prototype.findIndex.call(items, item => item.hasAttribute('data-focus'))
130130
},
131131

132-
setActive(el) {
132+
setFocus(el) {
133133
this.clearFocus()
134134
el.setAttribute('data-focus', '')
135135
this.refs.menu.setAttribute('aria-activedescendant', el.id)

0 commit comments

Comments
 (0)