Skip to content

Commit

Permalink
refactor; remove console.log
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelchadwick committed Dec 12, 2024
1 parent 3fa46c9 commit e748a4b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ export default class CoursePublicationMenuComponent extends Component {
item?.parentElement.lastElementChild.focus();
}
}

async handleArrowDown(item) {
if (item.classList.value == 'toggle') {
this.isOpen = true;
Expand All @@ -90,25 +91,21 @@ export default class CoursePublicationMenuComponent extends Component {
}

@action
async toggleMenu(event) {
console.log('course toggleMenu', event.target);
async toggleMenu() {
this.isOpen = !this.isOpen;

if (this.isOpen) {
await this.focusFirstLink.perform();
}
}
@action
keyUp(event) {
event.stopPropagation();
event.preventDefault();

switch (event.key) {
keyUp({ key, target }) {
switch (key) {
case 'ArrowDown':
this.handleArrowDown(event.target);
this.handleArrowDown(target);
break;
case 'ArrowUp':
this.handleArrowUp(event.target);
this.handleArrowUp(target);
break;
case 'Escape':
case 'Tab':
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ export default class SessionPublicationMenuComponent extends Component {
item?.parentElement.lastElementChild.focus();
}
}

async handleArrowDown(item) {
if (item.classList.value == 'toggle') {
this.isOpen = true;
Expand All @@ -94,25 +95,21 @@ export default class SessionPublicationMenuComponent extends Component {
}

@action
async toggleMenu(event) {
console.log('session toggleMenu', event.target);
async toggleMenu() {
this.isOpen = !this.isOpen;

if (this.isOpen) {
await this.focusFirstLink.perform();
}
}
@action
keyUp(event) {
event.stopPropagation();
event.preventDefault();

switch (event.key) {
keyUp({ key, target }) {
switch (key) {
case 'ArrowDown':
this.handleArrowDown(event.target);
this.handleArrowDown(target);
break;
case 'ArrowUp':
this.handleArrowUp(event.target);
this.handleArrowUp(target);
break;
case 'Escape':
case 'Tab':
Expand Down

0 comments on commit e748a4b

Please sign in to comment.