don't move text cursor when defocusing window
Hunter
Friday, August 23rd, 2024 at 1:24 AM
408 taskInput.addEventListener('keydown', keydownHandler);
409 taskInput.addEventListener('keyup', keyupHandler);
410 taskInput.addEventListener('keydown', handleCopyAndCut);
- taskInput.addEventListener('blur', function() {
- placeCursorAtBeginning(this);
411 + appContainer.addEventListener('focusin', function(e) {
412 + if (e.target.tagName === 'INPUT' && e.target.type === 'text') {
413 + document.querySelectorAll('input[type="text"]').forEach(input => {
414 + if (input !== e.target) {
415 + placeCursorAtBeginning(input);
416 + }
417 + });
418 + }
419 });
420
421 taskInput.addEventListener('input', () => {
710 }
711
712 function selectAndFocusTask(task) {
- const activeInput = document.querySelector('.task-container.active input[type="text"]');
- if (activeInput) {
- placeCursorAtBeginning(activeInput);
- }
-
713 const taskInput = document.querySelector(`.task-container[data-id="${task.id}"] input[type="text"]`);
714 if (taskInput) {
715 taskInput.focus();