Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 13 additions & 9 deletions app/src/components/RepoView/Repo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -167,9 +167,11 @@
},

data() {
const repoName = decodeURIComponent( this.repoName );
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cache the potentially "expensive" value

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

jap... totally with you here. :)


return {
currentCommand : null,
repo : this.repos.find( repo => repo.name === decodeURIComponent( this.repoName ) ),
repo : this.repos.find( ( { name } ) => name === repoName ),
scripts : [],
scriptElements : null
};
Expand All @@ -183,15 +185,17 @@

methods : {
handleUp( target ) {
if ( this.scriptElements.length < 1 ) {
Copy link
Copy Markdown
Contributor Author

@stryju stryju Jul 23, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

early escape (could possibly be added to handleDown() as well)

return;
}

let index = [].indexOf.call( this.scriptElements, target );

if ( index === -1 ) {
index = this.scriptElements.length;
}

if ( index > 0 ) {
this.scriptElements[ index - 1 ].focus();
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

for the early escape approach, but I'll revert this parts of this change in master again.

Because

if ( index > 0 ) {
  this.scriptElements[ index - 1 ].focus();
}

this is still needed. Currently it's throwing... I missed that one too.

Logic should be, if the current focused element is not the first one, then focus the one before.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oooh!

this.scriptElements[ index - 1 ].focus();
},

handleRight( target ) {
Expand All @@ -203,7 +207,7 @@
handleDown( target ) {
let index = [].indexOf.call( this.scriptElements, target );

if ( index < this.scriptElements.length -1 ) {
if ( index < this.scriptElements.length - 1 ) {
this.scriptElements[ index + 1 ].focus();
}
},
Expand All @@ -226,8 +230,8 @@
this.$set(
'currentCommand',
{
script : script,
options : options
script,
options
}
);
}
Expand All @@ -241,7 +245,7 @@

vuex : {
actions : {
removeRepoAction : removeRepoAction
removeRepoAction
},

getters : {
Expand Down