fix(Combobox): highlightMenuItem works correctly#3644
Open
mshatikhin wants to merge 3 commits intonextfrom
Open
fix(Combobox): highlightMenuItem works correctly#3644mshatikhin wants to merge 3 commits intonextfrom
mshatikhin wants to merge 3 commits intonextfrom
Conversation
There was a problem hiding this comment.
Copilot reviewed 1 out of 1 changed files in this pull request and generated no comments.
Comments suppressed due to low confidence (2)
packages/react-ui/internal/CustomComboBox/CustomComboBoxReducer.tsx:168
- Consider using optional chaining (menu?.reset()) for consistency and to avoid potential runtime errors if menu is undefined.
menu.reset();
packages/react-ui/internal/CustomComboBox/CustomComboBoxReducer.tsx:180
- Replacing menu.down() with menu.highlightItem(0) changes the behavior; please verify that this new behavior meets the intended UX requirements.
globalObject.requestAnimationFrame?.(() => menu?.highlightItem(0));
mshatikhin
commented
Apr 7, 2025
| index = items.findIndex((x) => itemToValue(x) === itemToValue(value)); | ||
| menu.highlightItem(index); | ||
| } else { | ||
| menu.reset(); |
Member
Author
There was a problem hiding this comment.
Это чинит сценарий когда:
1 шаг чтото поискали, но не выбрали,
2 шаг ввели еще символы в поиск чтобы ничего не нашлось -- нажали Enter - будет выбран элемент который был первым на первом шаге
| const queryTextDifferenceOfSavedValue = textValue !== valueString; | ||
| const needFocusToRefreshButton = requestStatus === ComboBoxRequestStatus.Failed; | ||
| if (queryTextDifferenceOfSavedValue || needFocusToRefreshButton) { | ||
| globalObject.requestAnimationFrame?.(() => menu?.highlightItem(0)); |
Member
Author
There was a problem hiding this comment.
Это чинит сценарий:
Пишем в поиск Item. Выделился первый пункт в списке
Добавляем пробел в поиске. Выделился второй пункт. Почему?
Удаляем проблем в поиске. Выделился третий пункт. Почему?
65e7977 to
739953c
Compare
1366c4f to
2c72c85
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Проблема
Решение
Ссылки
https://yt.skbkontur.ru/issue/IF-2215/ComboBox.-Regress.-Strannoe-povedenie-nachinaya-s-5.0
Чек-лист перед запросом ревью
Добавлены тесты на все изменения
⬜ unit-тесты для логики
⬜ скриншоты для верстки и кросс-браузерности
⬜ нерелевантно
Добавлена (обновлена) документация
⬜ styleguidist для пропов и примеров использования компонентов
⬜ jsdoc для утилит и хелперов
⬜ комментарии для неочевидных мест в коде
⬜ прочие инструкции (
README.md,contributing.mdи др.)⬜ нерелевантно
Изменения корректно типизированы
⬜ без использования
any(см. PR2856)⬜ нерелевантно
Прочее
⬜ все тесты и линтеры на CI проходят
⬜ в коде нет лишних изменений
⬜ заголовок PR кратко и доступно отражает суть изменений (он попадет в changelog)