Skip to content

Commit

Permalink
chore: fix project selector
Browse files Browse the repository at this point in the history
  • Loading branch information
LeandroTorresSicilia committed Jan 22, 2021
1 parent 794e2ed commit caed598
Showing 1 changed file with 8 additions and 17 deletions.
25 changes: 8 additions & 17 deletions library/styleguideComponents/ProjectSelector/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable import/no-extraneous-dependencies */
/* eslint-disable no-script-url */
import React, { Component } from 'react';
import classnames from 'classnames';
Expand Down Expand Up @@ -51,14 +52,6 @@ export default class ProjectSelector extends Component {
return classnames('react-rainbow-selector', { 'react-rainbow-selector--open': isOpen });
}

getTabIndex() {
const { isOpen } = this.state;
if (isOpen) {
return -1;
}
return 0;
}

handleKeyPressed(event) {
if (this.keyHandlerMap[event.keyCode]) {
return this.keyHandlerMap[event.keyCode]();
Expand All @@ -70,7 +63,8 @@ export default class ProjectSelector extends Component {
const { childFocusedIndex } = this.state;
if (this.references.length < 2) {
return null;
} else if (childFocusedIndex === 0) {
}
if (childFocusedIndex === 0) {
return this.focusChild(this.references.length - 1);
}
return this.focusChild(childFocusedIndex - 1);
Expand All @@ -80,7 +74,8 @@ export default class ProjectSelector extends Component {
const { childFocusedIndex } = this.state;
if (this.references.length < 2) {
return null;
} else if (childFocusedIndex === this.references.length - 1) {
}
if (childFocusedIndex === this.references.length - 1) {
return this.focusChild(0);
}
return this.focusChild(childFocusedIndex + 1);
Expand Down Expand Up @@ -136,13 +131,9 @@ export default class ProjectSelector extends Component {
<li
className="react-rainbow-selector_selected-item-section"
onClick={this.toggleMenu}
role="menuitem"
role="presentation"
>
<a
href="javascript:void(0);"
className="react-rainbow-selector_item"
tabIndex={this.getTabIndex()}
>
<span className="react-rainbow-selector_item">
<img
src={rainbowLogo}
alt="react-rainbow"
Expand All @@ -156,7 +147,7 @@ export default class ProjectSelector extends Component {
version {componentLibraryVersion}
</span>
</div>
</a>
</span>
<RightArrow isExpanded={isOpen} />
</li>
<RenderIf isTrue={isOpen}>
Expand Down

0 comments on commit caed598

Please sign in to comment.