Skip to content

Commit

Permalink
Focus text input contents on focus
Browse files Browse the repository at this point in the history
Clicking on the foreground and background text inputs with the mouse, this now automatically selects the entire contents of the input (as happens aleady for keyboard users when they set focus to it). This facilitates going in to edit/type colors...
  • Loading branch information
patrickhlauke committed Sep 9, 2018
1 parent 3289212 commit 5ed33fb
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/views/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ function initEvents () {
document.querySelector('#background-color .rgb').onclick = function() {showHide(this)}
document.querySelector('#foreground-color input').oninput = function() {validateForegroundText(this.value)}
document.querySelector('#background-color input').oninput = function() {validateBackgroundText(this.value)}
document.querySelector('#foreground-color input').onfocus = function() {this.select()}
document.querySelector('#background-color input').onfocus = function() {this.select()}
document.querySelector('#foreground-color input').onblur = function() {leaveText('foreground', this)}
document.querySelector('#background-color input').onblur = function() {leaveText('background', this)}
document.querySelector('#foreground-color .switch').onclick = function() {ipcRenderer.send('switchColors')}
Expand Down

0 comments on commit 5ed33fb

Please sign in to comment.