Skip to content

feat: generate labels and placeholders for form inputs#1881

Open
damian-k-dev wants to merge 2 commits into
mate-academy:masterfrom
damian-k-dev:develop
Open

feat: generate labels and placeholders for form inputs#1881
damian-k-dev wants to merge 2 commits into
mate-academy:masterfrom
damian-k-dev:develop

Conversation

@damian-k-dev
Copy link
Copy Markdown

No description provided.

Copy link
Copy Markdown

@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

The implementation has two explicit requirement violations that need to be addressed. First, the code uses document.querySelectorAll('input') which selects all inputs on the page, but the requirement explicitly states to get inputs from the form tag. You need to first select the form element, then query its inputs using something like document.querySelector('form').querySelectorAll('input'). Second, the placeholder text is not capitalized as explicitly required in step 3 of the task. You need to transform the name value so the first letter is capitalized, such as using .charAt(0).toUpperCase() + name.slice(1). Both issues are directly tied to specific checklist items and will cause test failures.


✨ 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

Comment thread src/scripts/main.js Outdated
'use strict';

// write code here
const formInputs = document.querySelectorAll('input');
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The selector should target inputs within the form element, not all inputs on the page. Use document.querySelector('form').querySelectorAll('input') or document.querySelector('form input').

Comment thread src/scripts/main.js Outdated
label.setAttribute('for', input.getAttribute('id'));
label.textContent = input.getAttribute('name');
input.insertAdjacentElement('beforebegin', label);
input.setAttribute('placeholder', input.getAttribute('name'));
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The placeholder value should be capitalized according to step 3 of the requirements. Use input.getAttribute('name').charAt(0).toUpperCase() + input.getAttribute('name').slice(1) or a similar approach to capitalize the first letter.

Copy link
Copy Markdown

@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

Your solution is approved. All requirements have been successfully implemented and verified: labels are created with the correct field-label class and for attribute matching input IDs, placeholder text is properly capitalized, and labels are inserted as siblings before each input using insertAdjacentElement('beforebegin', label). The two previously identified issues—input selection now correctly scoped to form elements and placeholder capitalization implemented via a dedicated function—have both been resolved. The code is clean and follows the implementation steps as specified.


✨ 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