Repository navigation
FormTokenField: Match labels in suggestions instead of keys when searching for values #74772
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
85fd6a1
6de21f4
b382890
37ae055
1f02f2c
2d3a6c7
9ed36f9
7e6174b
0fd48ab
6fde79a
1deae38
f6f7acc
d849dc7
8011220
f4c27a6
593a00a
cc1190b
1fd7f21
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -77,6 +77,9 @@ export function SuggestionsList< | |
| .normalize( 'NFKC' ) | ||
| .toLocaleLowerCase() | ||
| .indexOf( matchText ); | ||
| if ( indexOfMatch < 0 ) { | ||
| return null; | ||
| } | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What scenario is this new condition meant to handle?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I added this as an early fail mechanism. Otherwise, the subsequent check will be: transformedSuggestion.substring(
0,
-1
)Which might produce weird results.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Right, but when would that actually happen, and why wasn't it a problem before?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmmm, this would trigger when there is no match. I only added it because I thought it made sense, but it's true that it wasn't there before, and there were no known side effects. So let's drop it (cc1190b)
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, this would be a good example of a thing where it'd be good to have regression testing coverage covering the scenario if it were in-fact an issue. |
||
|
|
||
| return { | ||
| suggestionBeforeMatch: transformedSuggestion.substring( | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.