Toggle focus between tree and text.

This commit is contained in:
Magnus Åhall 2025-02-09 20:22:26 +01:00
parent 8f15664b88
commit 4ce8ed9a08
3 changed files with 13 additions and 8 deletions

View file

@ -19,10 +19,14 @@ html {
} }
#tree { #tree {
grid-area: tree; grid-area: tree;
padding: 16px; padding: 16px 32px;
background-color: #333; background-color: #333;
color: #ddd; color: #ddd;
z-index: 100; z-index: 100;
border-left: 2px solid #333;
}
#tree:focus {
border-left: 2px solid #FE5F55;
} }
#tree #logo { #tree #logo {
display: grid; display: grid;
@ -188,7 +192,6 @@ html {
max-width: 900px; max-width: 900px;
white-space: pre-wrap; white-space: pre-wrap;
word-wrap: break-word; word-wrap: break-word;
color: #f0f;
background: rgba(0, 255, 255, 0.5); background: rgba(0, 255, 255, 0.5);
justify-self: center; justify-self: center;
/* Hidden from view, clicks, and screen readers */ /* Hidden from view, clicks, and screen readers */

View file

@ -205,12 +205,15 @@ export class NodeUI extends Component {
// All keybindings is Alt+Shift, since the popular browsers at the time (2023) allows to override thees. // All keybindings is Alt+Shift, since the popular browsers at the time (2023) allows to override thees.
// Ctrl+S is the exception to using Alt+Shift, since it is overridable and in such widespread use for saving. // Ctrl+S is the exception to using Alt+Shift, since it is overridable and in such widespread use for saving.
// Thus, the exception is acceptable to consequent use of alt+shift. // Thus, the exception is acceptable to consequent use of alt+shift.
if (!(evt.shiftKey && evt.altKey) && !(evt.key.toUpperCase() == 'S' && evt.ctrlKey)) if (!(evt.shiftKey && evt.altKey) && !(evt.key.toUpperCase() === 'S' && evt.ctrlKey))
return return
switch (evt.key.toUpperCase()) { switch (evt.key.toUpperCase()) {
case 'T': case 'T':
_notes2.current.tree.treeDiv.current?.focus() if (document.activeElement.id === 'tree')
document.getElementById('node-content').focus()
else
document.getElementById('tree').focus()
break break
/* /*
case 'C': case 'C':
@ -260,7 +263,6 @@ export class NodeUI extends Component {
evt.stopPropagation() evt.stopPropagation()
} }
}//}}} }//}}}
} }
class NodeContent extends Component { class NodeContent extends Component {

View file

@ -48,13 +48,14 @@ html {
#tree { #tree {
grid-area: tree; grid-area: tree;
padding: 16px; padding: 16px 32px;
background-color: #333; background-color: #333;
color: #ddd; color: #ddd;
z-index: 100; // Over crumbs shadow z-index: 100; // Over crumbs shadow
border-left: 2px solid #333;
&:focus { &:focus {
//background-color: #f0f; border-left: 2px solid #FE5F55;
} }
#logo { #logo {
@ -256,7 +257,6 @@ html {
max-width: 900px; max-width: 900px;
white-space: pre-wrap; white-space: pre-wrap;
word-wrap: break-word; word-wrap: break-word;
color: #f0f;
background: rgba(0, 255, 255, 0.5); background: rgba(0, 255, 255, 0.5);
justify-self: center; justify-self: center;