-
-
Notifications
You must be signed in to change notification settings - Fork 35.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ToDo App addOrUpdateTaskBtn
text is not properly updating after editing task
#53076
Comments
Can you suggest me the file name for this issue? |
Hi @shivam-0510 ! I am above to post a reply on the fixes needed for this change because it affects multiple files since all of the seed code will need to be updated too |
HI @Only-Czesio ! Thank you for opening this issue. We will open this up for contribution soon for contributors interested in working on this. I will post a reply on the changes needed. addOrUpdateTaskBtn.ariaLabel = “Add Task”; we recently had PR to remove the |
After reviewing the project, it would be best to introduce a new step after step 45 here. We should insert a new step 46 that has the following instructions # --description--
If you try to add a new task, edit that task, and then click on the `"Add New task"` button, you will notice a bug.
The form button will display the incorrect text of `"Update Task"` instead of `"Add Task"`. To fix this, you will need to update your `addOrUpdateTask` function to update the `innerText` of the `addOrUpdateTaskBtn` to `"Add Task"`. This has been opened for contribution. The first comprehensive PR created will be reviewed and merged. We typically do not assign issues to anyone other than long-time contributors. If you would like to contribute and have not read the contributors docs, please do so here: https://contribute.freecodecamp.org/#/ If you have any issues with contributing, be sure to join us on the contributors channel, or on the contributors sub-forum Files that need to be changedThis fix requires you to create a new step 46 Please use the description made above and add the appropriate tests. Then for steps 47 through to the end, you will need to add the solution of the correct answer |
addOrUpdateTaskBtn
text is not properly updating after editing task
addOrUpdateTaskBtn
text is not properly updating after editing taskaddOrUpdateTaskBtn
text is not properly updating after editing task
I have added the PR, please review it #53094 |
addOrUpdateTaskBtn
text is not properly updating after editing taskaddOrUpdateTaskBtn
text is not properly updating after editing task
Describe the Issue
About the Todo App —> When updating a task we are changing the innerText :
addOrUpdateTaskBtn.innerText = “Update Task”;
addOrUpdateTaskBtn.ariaLabel = “Update Task”;
and then when we are creating new task the button stay with text "Update Task".
So for future coders it would be nice to create somewhere in the way step to change back when creating task to
addOrUpdateTaskBtn.innerText = “Create Task”;
addOrUpdateTaskBtn.ariaLabel = “Create Task”;
Affected Page
https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures-v8/learn-localstorage-by-building-a-todo-app/step-57
Your code
Expected behavior
const addOrUpdateTask = () => {
addOrUpdateTaskBtn.innerText = "Add Task";
addOrUpdateTaskBtn.ariaLabel = "Add Task";
const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id);
const taskObj = {
id:
${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}
,title: titleInput.value,
date: dateInput.value,
description: descriptionInput.value,
};
if (dataArrIndex === -1) {
taskData.unshift(taskObj);
} else {
taskData[dataArrIndex] = taskObj;
}
localStorage.setItem("data", JSON.stringify(taskData));
updateTaskContainer()
reset()
};
Screenshots
No response
System
Additional context
Adding this two lines of code to function addOrUpdateTask fix the problem
const addOrUpdateTask = () => {
addOrUpdateTaskBtn.innerText = "Add Task";
addOrUpdateTaskBtn.ariaLabel = "Add Task";
The text was updated successfully, but these errors were encountered: