Skip to content

Commit

Permalink
refactor(menu): remove unused property, update comments
Browse files Browse the repository at this point in the history
Changes to be committed:
modified:   src/auro-menu.js
  • Loading branch information
blackfalcon committed Feb 3, 2022
1 parent 2963df2 commit 45d5d0a
Showing 1 changed file with 11 additions and 14 deletions.
25 changes: 11 additions & 14 deletions src/auro-menu.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* eslint-disable no-magic-numbers */
/* eslint-disable no-plusplus */
// Copyright (c) 2021 Alaska Airlines. All right reserved. Licensed under the Apache-2.0 license
// See LICENSE in the project root for license information.

Expand All @@ -22,20 +21,14 @@ import "focus-visible/dist/focus-visible.min.js";
class AuroMenu extends LitElement {
constructor() {
super();

this.options = null;
this.value = undefined;
}

static get properties() {
return {
// static get properties() {
// return {

/**
* @private
*/
options: { type: Array }
};
}
// };
// }

static get styles() {
return [
Expand All @@ -51,7 +44,7 @@ class AuroMenu extends LitElement {
}

/**
* Custom event for click events.
* Manage click events.
* Event fires, but attributes are not changed on elements with the disabled attribute.
* @private
* @param {Object} event - Event object from the browser.
Expand All @@ -75,20 +68,23 @@ class AuroMenu extends LitElement {
}

/**
* Manage ArrowDown, ArrowUp and Enter events.
* Manage ArrowDown, ArrowUp and Enter keyboard events.
* @private
* @param {Object} event - Event object from the browser.
*/
handleKeyDown(event) {
event.preventDefault();

// With each keyboard 'enter' event, reset attr settings on options.
this.items.forEach((item) => {
if (event.key === `Enter`) {
item.removeAttribute('selected');
item.removeAttribute('aria-selected');
}
});

// With ArrowDown/ArrowUp events, pass new value to selectNextItem()
// With Enter event, set value and apply attrs
switch (event.key) {
case "ArrowDown":
event.target.tabIndex = -1;
Expand Down Expand Up @@ -140,6 +136,7 @@ class AuroMenu extends LitElement {

/**
* Custom event that returns the selected option's value.
* Use event to trigger the state of wrapping elements.
* @private
*/
selectedOption() {
Expand All @@ -165,7 +162,7 @@ class AuroMenu extends LitElement {

/**
* This function will iterate over the array of items in the slot find the selected
* option that is not disabled and apply tabindex=0 to set tab order.
* option that is not disabled and apply tabindex='0' to set tab order.
* @private
*/
initializeIndex() {
Expand Down

0 comments on commit 45d5d0a

Please sign in to comment.