Skip to content

Commit

Permalink
fix(ui): 🚸 keyboard tab focus on keystore related to #36
Browse files Browse the repository at this point in the history
  • Loading branch information
jojobyte committed Feb 11, 2024
1 parent 0b654d4 commit 4cc1303
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 4 deletions.
30 changes: 27 additions & 3 deletions src/components/dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,24 @@ const initialState = {
}
event.target.reportValidity()
},
handleFocus: state => event => {
handleBlur: state => event => {
// event.preventDefault()
// console.log(
// 'handle input focus',
// 'handle input blur',
// event,
// )
},
handleFocusOut: state => event => {
// event.preventDefault()
// console.log(
// 'handle input focus out',
// event,
// )
},
handleFocusIn: state => event => {
// event.preventDefault()
// console.log(
// 'handle input focus in',
// event,
// )
},
Expand Down Expand Up @@ -315,10 +329,20 @@ export async function setupDialog(
)
}

addListener(
form,
'blur',
state.events.handleBlur(state),
)
addListener(
form,
'focusout',
state.events.handleFocus(state),
state.events.handleFocusOut(state),
)
addListener(
form,
'focusin',
state.events.handleFocusIn(state),
)
addListener(
form,
Expand Down
10 changes: 10 additions & 0 deletions src/rigs/phrase-import.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,16 @@ export let phraseImportRig = (async function (globals) {
`,
fields: html``,
events: {
handleFocusOut: state => event => {
if (event.target.id === 'keystore') {
event.target.parentElement.classList.remove('focus')
}
},
handleFocusIn: state => event => {
if (event.target.id === 'keystore') {
event.target.parentElement.classList.add('focus')
}
},
handleClose: (
state,
resolve = res=>{},
Expand Down
2 changes: 1 addition & 1 deletion src/rigs/send-or-request.js
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ export let sendOrReceiveRig = (async function (globals) {
}
}
},
handleFocus: state => event => {
handleFocusOut: state => event => {
// event.preventDefault()
// console.log(
// 'handle input focus',
Expand Down
3 changes: 3 additions & 0 deletions src/styles/form.css
Original file line number Diff line number Diff line change
Expand Up @@ -641,6 +641,9 @@ form[name="network"] {
.updrop.drag-over {
border-style: solid;
}
.updrop.focus{
border-style: dotted;
}
.dropped .updrop,
.updrop.dropped {
background-color: var(--dark-900);
Expand Down

0 comments on commit 4cc1303

Please sign in to comment.