|
|
@ -106,7 +106,7 @@ export default class ComposerOptionsDropdownContent extends React.PureComponent |
|
|
|
const index = items.findIndex(item => { |
|
|
|
const index = items.findIndex(item => { |
|
|
|
return (item.name === name); |
|
|
|
return (item.name === name); |
|
|
|
}); |
|
|
|
}); |
|
|
|
let element; |
|
|
|
let element = null; |
|
|
|
|
|
|
|
|
|
|
|
switch(e.key) { |
|
|
|
switch(e.key) { |
|
|
|
case 'Escape': |
|
|
|
case 'Escape': |
|
|
@ -117,18 +117,10 @@ export default class ComposerOptionsDropdownContent extends React.PureComponent |
|
|
|
this.handleClick(e); |
|
|
|
this.handleClick(e); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case 'ArrowDown': |
|
|
|
case 'ArrowDown': |
|
|
|
element = this.node.childNodes[index + 1]; |
|
|
|
element = this.node.childNodes[index + 1] || this.node.firstChild; |
|
|
|
if (element) { |
|
|
|
|
|
|
|
element.focus(); |
|
|
|
|
|
|
|
this.handleChange(element.getAttribute('data-index')); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
break; |
|
|
|
break; |
|
|
|
case 'ArrowUp': |
|
|
|
case 'ArrowUp': |
|
|
|
element = this.node.childNodes[index - 1]; |
|
|
|
element = this.node.childNodes[index - 1] || this.node.lastChild; |
|
|
|
if (element) { |
|
|
|
|
|
|
|
element.focus(); |
|
|
|
|
|
|
|
this.handleChange(element.getAttribute('data-index')); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
break; |
|
|
|
break; |
|
|
|
case 'Tab': |
|
|
|
case 'Tab': |
|
|
|
if (e.shiftKey) { |
|
|
|
if (e.shiftKey) { |
|
|
@ -136,27 +128,20 @@ export default class ComposerOptionsDropdownContent extends React.PureComponent |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
element = this.node.childNodes[index + 1] || this.node.firstChild; |
|
|
|
element = this.node.childNodes[index + 1] || this.node.firstChild; |
|
|
|
} |
|
|
|
} |
|
|
|
if (element) { |
|
|
|
|
|
|
|
element.focus(); |
|
|
|
|
|
|
|
this.handleChange(element.getAttribute('data-index')); |
|
|
|
|
|
|
|
e.preventDefault(); |
|
|
|
|
|
|
|
e.stopPropagation(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
break; |
|
|
|
break; |
|
|
|
case 'Home': |
|
|
|
case 'Home': |
|
|
|
element = this.node.firstChild; |
|
|
|
element = this.node.firstChild; |
|
|
|
if (element) { |
|
|
|
|
|
|
|
element.focus(); |
|
|
|
|
|
|
|
this.handleChange(element.getAttribute('data-index')); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
break; |
|
|
|
break; |
|
|
|
case 'End': |
|
|
|
case 'End': |
|
|
|
element = this.node.lastChild; |
|
|
|
element = this.node.lastChild; |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (element) { |
|
|
|
if (element) { |
|
|
|
element.focus(); |
|
|
|
element.focus(); |
|
|
|
this.handleChange(element.getAttribute('data-index')); |
|
|
|
this.handleChange(element.getAttribute('data-index')); |
|
|
|
} |
|
|
|
e.preventDefault(); |
|
|
|
break; |
|
|
|
e.stopPropagation(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|