Skip to content

Commit

Permalink
Merge pull request #14 from suresh-gangumalla/fix/focus-hanlding-page…
Browse files Browse the repository at this point in the history
…-issues

fixed menu unfocus issue on right key
  • Loading branch information
michielvandergeest authored Feb 16, 2024
2 parents 8522906 + 3675ef1 commit 9decf99
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
8 changes: 3 additions & 5 deletions src/components/Menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,14 @@ export default Blits.Component('Menu', {
state() {
return {
x: -360,
focused: null,
focused: 1,
}
},
hooks: {
focus() {
this.focused = 1
this.$trigger('focused')
this.x = 0
},
unfocus() {
this.x = -360
},
},
watch: {
focused() {
Expand All @@ -56,12 +52,14 @@ export default Blits.Component('Menu', {
input: {
right() {
this.parent.focus()
this.x = -360
},
down() {
this.focused = Math.min(this.focused + 1, 4)
},
up() {
this.focused = Math.max(this.focused - 1, 1)
},
left() {},
},
})
3 changes: 1 addition & 2 deletions src/pages/FocusHandling.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,11 @@ export default Blits.Component('FocusHandling', {
</Element>`,
state() {
return {
focused: null,
focused: 1,
}
},
hooks: {
focus() {
this.focused = 1
this.$trigger('focused')
},
},
Expand Down

0 comments on commit 9decf99

Please sign in to comment.