Skip to content

js_task_fix_form_DOM#1819

Open
A1daros wants to merge 2 commits intomate-academy:masterfrom
A1daros:develop
Open

js_task_fix_form_DOM#1819
A1daros wants to merge 2 commits intomate-academy:masterfrom
A1daros:develop

Conversation

@A1daros
Copy link

@A1daros A1daros commented Feb 19, 2026

No description provided.

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

I am requesting changes because there are a couple of functional issues that can interfere with the expected behavior of the form. Your script correctly creates labels and placeholders from the name attribute, sets for/id properly, and inserts labels before each input, which matches the core of the task. However, you currently apply this logic to all form input elements, which likely includes type="submit", button, reset, hidden, and similar controls; adding labels and placeholders to these can break semantics and may cause the automated tests to fail. You should update the loop in src/scripts/main.js (around the line where you iterate over document.querySelectorAll('form input')) to skip inputs whose type is in a list like ['submit', 'button', 'reset', 'hidden', 'image'].

A smaller, non-blocking improvement: you already generate a nicely title-cased label string from the name, but the placeholder only capitalizes the first character; you could simply reuse the same title-cased label text for the placeholder so both match. Also, double-check your README demo link to ensure <your_account> has been replaced with your actual GitHub username, as required by the task instructions. Once you filter out non-field input types and confirm the demo URL, your solution should fully satisfy the task requirements—this is very close, and the main logic is solid.


✨ 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

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

I am approving your solution because the core functionality is correctly implemented and there are no critical blockers. Your script correctly selects form inputs, creates associated labels with the proper field-label class and for attribute (creating IDs when missing), derives the label/placeholder text from input.name, capitalizes it, and inserts the label before the input without changing the HTML structure. You also correctly skip non-field input types like submit, button, reset, hidden, and image, which aligns with the task requirements.

The remaining point in src/scripts/main.js is a minor cleanup: you currently set label.textContent twice (around lines 21 and 25). A simple improvement is to compute the capitalized/title-cased text once (e.g., const capitalized = ...) and then reuse it for both label.textContent and input.placeholder, which keeps the code DRY and a bit clearer. Separately from the script, double-check your README/demo link to ensure <your_account> has been replaced with your actual GitHub username as required by the checklist [CHECKLIST ITEM #1]. Overall, your implementation meets the functional requirements well; consider the small refactor and README check as polish for a production-quality submission.


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

Footnotes

  1. Rate AI review example

Comment on lines +21 to +25
label.textContent = labelText.replace(/\b\w/g, (c) => c.toUpperCase());

const capitalized = labelText.replace(/\b\w/g, (c) => c.toUpperCase());

label.textContent = capitalized;

Choose a reason for hiding this comment

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

You set the label text twice. Compute the capitalized/title-cased string once and reuse it for both label.textContent and input.placeholder instead of assigning label.textContent on lines 21 and 25.

Example approach: compute const capitalized = ... then label.textContent = capitalized; input.placeholder = capitalized;

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