Skip to content

feat: label and placeholders to exicting inputs#1825

Open
dmytro-halieba wants to merge 3 commits intomate-academy:masterfrom
dmytro-halieba:develop
Open

feat: label and placeholders to exicting inputs#1825
dmytro-halieba wants to merge 3 commits intomate-academy:masterfrom
dmytro-halieba:develop

Conversation

@dmytro-halieba
Copy link

Copy link

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Summary

Great job setting up the DOM manipulation to add the labels and placeholders! I am requesting a couple of changes to fully meet the project requirements. Your solution is currently missing two key items:

  1. Missing for attribute: Each <label> needs a for attribute that matches the id of its corresponding <input>. This is crucial for accessibility. You can set this using label.htmlFor = input.id.
  2. Uncapitalized placeholder text: The requirements specify that the placeholder text should be capitalized (e.g., 'name' should become 'Name'). You can fix this by transforming the string before setting the placeholder attribute.

Once these are fixed, your solution will be perfect. Keep up the great work!


✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨

Important

Fix the issues, commit the changes, and then re-request my review using the Re-request review button2 in the Reviewers tab.

Tip

If you have any comments about this review, please leave a message in the Add a comment section below and mention me with the @mateacademy-ai-mentor tag3.
I will read your message during my next review of your pull request. Please do not reply directly to my comments, as that feature is not supported yet.

Caution

Do not close the pull request until the review is complete. Closing it early can lead to unexpected behavior and disrupt the review process.

Footnotes

  1. Rate AI review example

  2. Re-request AI review example

  3. Add AI review comments example

const signInInputs = Array.from(signInForm.getElementsByTagName('input'));

signUpInputs.forEach((input) => {
input.placeholder = input.name;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The task requires the placeholder text to be capitalized. For example, if input.name is 'email', the placeholder should be 'Email'.

const label = document.createElement('label');

label.textContent = input.name;
label.className = 'field-label';

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The label is missing its for attribute. To link the label to the input correctly, this attribute should be set to the input's id.

});

signInInputs.forEach((input) => {
input.placeholder = input.name;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just like with the sign-up form, the placeholder text for this input needs to be capitalized.

const label = document.createElement('label');

label.textContent = input.name;
label.className = 'field-label';

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This label also needs a for attribute that points to its corresponding input's id to be compliant with the requirements.

Copy link

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Summary

Great job adding the for attribute to the labels—that's a fantastic improvement for accessibility! Your solution is very close, but it requires one change to meet all the task requirements. The placeholder text for each input needs to be capitalized. You can apply the same capitalization logic you used for the label's text to fix this for both the sign-up and sign-in forms. As a suggestion for improvement, you could also refactor the duplicated logic into a single reusable function to make your code cleaner. Once the placeholder text is updated, this will be ready for approval!


✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨

Important

Fix the issues, commit the changes, and then re-request my review using the Re-request review button2 in the Reviewers tab.

Tip

If you have any comments about this review, please leave a message in the Add a comment section below and mention me with the @mateacademy-ai-mentor tag3.
I will read your message during my next review of your pull request. Please do not reply directly to my comments, as that feature is not supported yet.

Caution

Do not close the pull request until the review is complete. Closing it early can lead to unexpected behavior and disrupt the review process.

Footnotes

  1. Rate AI review example

  2. Re-request AI review example

  3. Add AI review comments example

const signInInputs = Array.from(signInForm.getElementsByTagName('input'));

signUpInputs.forEach((input) => {
input.placeholder = input.name;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to the task requirements, the placeholder text also needs to be capitalized. You can use the same logic you used for capitalizing the label's text.

});

signInInputs.forEach((input) => {
input.placeholder = input.name;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just like with the sign-up form, the placeholder text here needs to be capitalized to meet the requirements.

Copy link

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Summary

Excellent work on this task! You've successfully addressed the previous feedback by capitalizing the placeholder text, and your script now meets all the requirements. Your solution is approved.

For future improvement, consider how you might reduce code duplication. The logic for processing the sign-up and sign-in forms is very similar. You could create a single, reusable function to handle both, which would make your code cleaner and more maintainable. This is just a suggestion for best practice, as your current solution is correct. Keep up the great work!


✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨

Footnotes

  1. Rate AI review example

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants