update title when current parent text is modified

Hunter
Wednesday, July 31st, 2024 at 9:46 AM

todo.html+5-2

todo.html
 72  
 73  				const backspaceHandler = (function() {
 74  					let canDelete = true;
    -
 75  					return {
 76  						keydown: function(e) {
 77  							if (e.key === 'Backspace') {

111  
112  				taskInput.addEventListener('input', () => {
113  					task.text = taskInput.value;
114 +					if (task === currentTask) {
115 +						updatePageTitle(task);
116 +					}
117  				});
118 +
119  				taskInput.addEventListener('focus', () => setActiveTask(taskInput, task));
120  
121  				taskContainer.appendChild(checkbox);

488  			}
489  
490  			function updatePageTitle(task) {
    -				document.title = task.text || 'todo';
491 +				document.title = task.text || '?';
492  			}
493  
494  			renderCurrentView();