From c5bc98ac2150fb5c8de52ede355cc56ec856ab0a Mon Sep 17 00:00:00 2001 From: Jainam Shah <43648181+js0753@users.noreply.github.com> Date: Wed, 7 May 2025 06:59:11 -0400 Subject: [PATCH 1/2] fix: Select dropdown should scroll to the option with the closest prefix to the searched value. (#1146) --- src/OptionList.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/OptionList.tsx b/src/OptionList.tsx index d4c0109fb..a4859b248 100644 --- a/src/OptionList.tsx +++ b/src/OptionList.tsx @@ -154,7 +154,10 @@ const OptionList: React.ForwardRefRenderFunction = (_, r const timeoutId = setTimeout(() => { if (!multiple && open && rawValues.size === 1) { const value: RawValueType = Array.from(rawValues)[0]; - const index = memoFlattenOptions.findIndex(({ data }) => data.value === value); + // Scroll to the option closest to the searchValue if searching. + const index = memoFlattenOptions.findIndex(({ data }) => + searchValue ? String(data.value).startsWith(searchValue) : data.value === value, + ); if (index !== -1) { setActive(index); From 5694a13de3158c0d26677a62075af882b042df2b Mon Sep 17 00:00:00 2001 From: afc163 Date: Wed, 7 May 2025 19:00:49 +0800 Subject: [PATCH 2/2] chore: fix np branch --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index b2dc16eff..d84e58143 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,7 @@ "build": "dumi build", "prepare": "husky && dumi setup", "compile": "father build && lessc assets/index.less assets/index.css", - "prepublishOnly": "npm run compile && np --yolo --no-publish --branch 14.x", + "prepublishOnly": "npm run compile && np --yolo --no-publish --branch antd-5.x", "prettier": "prettier --write --ignore-unknown .", "lint": "eslint src/ docs/ tests/ --ext .tsx,.ts,.jsx,.js", "test": "rc-test",