Skip to content

Conversation

@Marcosld
Copy link
Contributor

No description provided.

@Marcosld Marcosld self-assigned this Dec 19, 2025
@Marcosld Marcosld changed the title WEB-2317: Search field empty suggestion and improvements feat(SearchField): WEB-2317 Search field empty suggestion and improvements Dec 19, 2025
@github-actions
Copy link

github-actions bot commented Dec 19, 2025

Size stats

master this branch diff
Total JS 16.5 MB 16.5 MB +1.3 kB
JS without icons 2.38 MB 2.38 MB +1.3 kB
Lib overhead 86.5 kB 86.5 kB 0 B
Lib overhead (gzip) 18.9 kB 18.9 kB 0 B

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is my last pr with import sorting XD

boxShadow:
'0px 2px 1px -1px rgba(0,0,0,0.2), 0px 1px 1px 0px rgba(0,0,0,0.14), 0px 1px 3px 0px rgba(0,0,0,0.12)',
background: 'white',
boxSizing: 'border-box',
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Easier to set a fixed width without having to take padding in account

</div>
)}
renderSuggestionsContainer={(options) => {
if (!isEmptyCase && options.children === null) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I had to add this because of the padding. An empty container was rendered when there were no options

@github-actions
Copy link

github-actions bot commented Dec 19, 2025

Deploy preview for mistica-web ready!

✅ Preview
https://mistica-mf18rgx3e-flows-projects-65bb050e.vercel.app

Built with commit ce05d90.
This pull request is being automatically deployed with vercel-action

@github-actions
Copy link

github-actions bot commented Dec 19, 2025

Accessibility report
✔️ No issues found

ℹ️ You can run this locally by executing yarn audit-accessibility.

@Marcosld Marcosld requested a review from aweell December 19, 2025 12:05
@github-actions
Copy link

github-actions bot commented Dec 19, 2025

Screenshot tests report

✔️ All passing

@Marcosld Marcosld marked this pull request as draft December 22, 2025 12:09
@Marcosld Marcosld marked this pull request as ready for review December 22, 2025 16:01
return allSuggestions.filter((item) => item.toLowerCase().includes(value.toLowerCase()));
};

test('Show show suggestions on focus when shouldShowSuggestions is "focus"', async () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
test('Show show suggestions on focus when shouldShowSuggestions is "focus"', async () => {
test('Should show suggestions on focus when shouldShowSuggestions is "focus"', async () => {

Comment on lines +80 to +82
didClearFieldRef.current = false;
inputRef?.current?.blur();
inputRef?.current?.focus();
Copy link
Contributor

Choose a reason for hiding this comment

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

can't we execute this on clearInput callback instead of using an effect?
maybe something like this:

const clearInput = React.useCallback(() => {
    flushSync(() => {
        handleChangeValue('', '');
        if (inputRef.current) {
            onChange?.(createChangeEvent(inputRef.current, ''));
        }
    });
    inputRef.current?.blur();
    inputRef.current?.focus();
}, [handleChangeValue, onChange]);

Comment on lines +571 to +572
{texts.searchFieldSuggestionsEmptyCase ||
t(tokens.searchFieldSuggestionsEmptyCase)}
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe this should be configurable at field level

Comment on lines +542 to +543
setIsEmptyCase(matchedSuggestions.length === 0);
setSuggestions(matchedSuggestions);
Copy link
Contributor

Choose a reason for hiding this comment

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

isn't this repeated state? you don't need an extra state for this. isEmptyCase state is derived from suggestions state:

const isEmptyCase = suggestions.length === 0

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