Skip to content

commit message#1149

Closed
alexsand-r wants to merge 3 commits intomate-academy:masterfrom
alexsand-r:react_autocomplete
Closed

commit message#1149
alexsand-r wants to merge 3 commits intomate-academy:masterfrom
alexsand-r:react_autocomplete

Conversation

@alexsand-r
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

Great work on the overall structure and core functionality! However, a few changes are needed to meet all the requirements. The most critical issue is that the onSelected callback prop is not being used correctly in Autocomplete.tsx, which prevents the selected person's name from appearing in the h1 tag. Additionally, your solution violates a couple of checklist items: the filter runs on input with only spaces [CHECKLIST ITEM #1], and an event handler has an unconventional name [CHECKLIST ITEM #4]. Lastly, for better accessibility in Item.tsx, the onClick handler should be on the clickable div element rather than the <p> tag. Please address these points, and your component will be ready!


✨ 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/components/Autocomplete.tsx Outdated
}, delay);
}, [delay]);

const showDropManu = (): void => {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This violates checklist item #4: 'follow [these] naming conventions for methods'. Since this function is an event handler for the onFocus event, a more conventional name would be handleFocus.

Comment on lines +42 to +44
return peopleFromServer.filter(el =>
el.name.toLowerCase().includes(valueInp.toLowerCase()),
);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This violates checklist item #1: 'make sure that filter won't be called if user entered spaces only'. Currently, the filter runs even if the input string consists only of whitespace. You should add a check to handle this case, for example, by trimming the input value and not running the filter if the result is an empty string.

Comment thread src/components/Item.tsx Outdated
Comment on lines +12 to +14
onClick={() => {
onSelect(user);
}}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

For better semantics and accessibility, the onClick handler should be placed on the parent div which has the is-clickable class. A <p> tag is not an interactive element by default, which means it's not keyboard-accessible (e.g., users can't tab to it). The div with the dropdown-item class represents the entire clickable suggestion.

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

Changes are needed to fully meet the requirements. The filter logic still runs on whitespace-only input (e.g., ' '), violating [CHECKLIST ITEM #1] — the component should treat such input as empty and skip filtering entirely. While getFilteredPeople correctly trims and checks !normalizedValue, the rendering condition query !== '' in List.tsx causes incorrect behavior: it shows the list or 'No suggestions' even when only spaces are entered. You must update the rendering logic to use the same normalized check (!normalizedValue) consistently across both filtering and display decisions. Also, please include src/components/Item.tsx in your next submission so I can verify the accessibility fix for the onClick handler placement [CHECKLIST ITEM #2]. Everything else — debounce, selection handling, callback propagation, and empty-state behavior — is implemented correctly and well-structured.


✨ 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
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

Excellent work on this iteration! I am approving your solution to help you progress, but there is one important accessibility improvement to address.

In src/components/Item.tsx, using a div with an onClick handler makes the component inaccessible to keyboard users. Interactive elements should use semantic tags like <button> or <a>. For Bulma's dropdown-item, an <a> tag is the recommended and accessible choice [CHECKLIST ITEM #2].

You did a fantastic job resolving the previous issue with whitespace handling, and the component now works perfectly. I also left a small suggestion in src/components/Autocomplete.tsx to make the rendering logic a bit cleaner. Keep up the great momentum!


✨ 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 +88 to +96
{!normalizedQuery && (
<List result={peopleFromServer} onSelect={handleSelect} />
)}

{normalizedQuery && result.length > 0 && (
<List result={result} onSelect={handleSelect} />
)}

{normalizedQuery && result.length === 0 && <NoSuggestions />}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This rendering logic is correct, but it can be simplified. The result variable already contains the correct list to display, whether it's the full list for an empty query or a filtered list. You can combine the first two conditions into a single check.

Consider this simplified version:

{result.length > 0 && (
  <List result={result} onSelect={handleSelect} />
)}

{normalizedQuery && result.length === 0 && <NoSuggestions />}

This refactoring removes the redundant condition and makes the code's intent clearer, as result is already correctly calculated to be either the full list or the filtered list based on the query.

@alexsand-r alexsand-r closed this by deleting the head repository Apr 13, 2026
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