-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
CustomSelectControl V2: prevent keyboard event propagation in legacy wrapper #62907
Changes from all commits
0a9971e
51ae912
36bce7b
fa60219
4426ec7
6ecbde2
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 |
---|---|---|
|
@@ -49,6 +49,15 @@ export type CustomSelectButtonProps = { | |
value?: string | string[]; | ||
}; | ||
|
||
// Props only exposed on the internal implementation | ||
export type _CustomSelectInternalProps = { | ||
/** | ||
* True if the consumer is emulating the legacy component behavior and look | ||
*/ | ||
isLegacy?: boolean; | ||
}; | ||
|
||
// Props that are exposed in exported components | ||
export type _CustomSelectProps = CustomSelectButtonProps & { | ||
/** | ||
* Additional className added to the root wrapper element. | ||
|
@@ -70,9 +79,7 @@ export type _CustomSelectProps = CustomSelectButtonProps & { | |
label: string; | ||
}; | ||
|
||
export type CustomSelectProps = _CustomSelectProps & | ||
CustomSelectButtonProps & | ||
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. Removed 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. @mirka — just making sure that you see this change, since you refactored these types last 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. Good catch, thanks 🙏 |
||
CustomSelectSize; | ||
export type CustomSelectProps = _CustomSelectProps & CustomSelectSize; | ||
|
||
/** | ||
* The legacy object structure for the options array. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I needed a way to allow the internal implementation to expose a
isLegacy
flag, without forwarding it to the public API of the V2 component. Not sure if we think there's a better way to do that? @mirkaThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't think of a better way, TBH.
What a bummer that we have to do it with hacks like this. It's an indication that the legacy adapter approach has probably too many downsides and won't be a recommended one in the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The legacy adapted approach definitely has its pros and cons.
It may not be worth keeping a common underlying implementation for V1 and V2 if we then have to abstract it and complicate it with extra props and exceptions. Let's keep it as-is for now and look back at it once V2 legacy wrapper has shipped and we look at V2