Skip to content

Commit

Permalink
fixed menu unfocus issue on right key
Browse files Browse the repository at this point in the history
Fixed menu unfocus and added listener for left Key in menu

Signed-off-by: Suresh Kumar Gangumalla <[email protected]>
  • Loading branch information
suresh-gangumalla committed Feb 15, 2024
1 parent 8522906 commit 3675ef1
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 3675ef1

Please sign in to comment.