Skip to content

Conversation

@Alexey-Pavlov
Copy link
Contributor

This pull request updates the behavior and appearance of the search button in the CioAutocomplete component. The main changes ensure that when the search button is clicked with an empty input, the input field is focused instead of submitting the form, and the button is no longer visually disabled. Related tests have been added to verify this behavior.

@Alexey-Pavlov Alexey-Pavlov requested review from a team and Copilot October 17, 2025 12:34
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR improves the search button UX by making it focus the input field when clicked with an empty value, rather than being disabled. The changes remove the disabled state styling and implement conditional behavior based on whether the input has a value.

Key changes:

  • Removed the disabled state from the search button, allowing it to be clicked at all times
  • Added onClick handler to focus the input field when the button is clicked with an empty input
  • Added tests to verify the new focus behavior and form submission functionality

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
src/styles.css Removed disabled cursor styling for the search button
src/components/Autocomplete/SearchInput/SearchInput.tsx Replaced disabled attribute with onClick handler that focuses input when empty
spec/Components/CioAutocomplete/CioAutocomplete.test.tsx Added tests for new search button focus and submit behaviors

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines +49 to +51
if (inputProps.id) {
document.getElementById(inputProps.id)?.focus();
}
Copy link

Copilot AI Oct 17, 2025

Choose a reason for hiding this comment

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

Using document.getElementById is unnecessary here since you already have access to the input element through React. Consider using a ref to access the input element directly, which is more idiomatic in React and avoids direct DOM manipulation.

Copilot uses AI. Check for mistakes.
Copy link
Contributor

@esezen esezen left a comment

Choose a reason for hiding this comment

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

LGTM!

@Alexey-Pavlov Alexey-Pavlov merged commit 66ff929 into main Oct 27, 2025
7 of 10 checks passed
@Alexey-Pavlov Alexey-Pavlov deleted the cdx-223-autocomplete-ui-the-search-button-on-click-should-focus-the branch October 27, 2025 13:10
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.

3 participants