-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Suggest2 does not render text box values on page load and text input dissapears #5804
Comments
Even though it might look like expected behavior, I am not sure if it is (am open to discussion) The rationale is based on this code: |
in private getPopoverTargetRenderer =
(listProps: QueryListRendererProps<T>, isOpen: boolean) =>
// eslint-disable-next-line react/display-name
({
// pull out `isOpen` so that it's not forwarded to the DOM
isOpen: _isOpen,
// pull out `defaultValue` due to type incompatibility with InputGroup
defaultValue,
ref,
...targetProps
}: Popover2TargetProps & React.HTMLProps<HTMLInputElement>) => {
const { disabled, fill, inputProps = {}, inputValueRenderer, popoverProps = {}, resetOnClose } = this.props;
const { selectedItem } = this.state;
const { handleKeyDown, handleKeyUp } = listProps;
const selectedItemText = selectedItem == null ? "" : inputValueRenderer(selectedItem);
const { autoComplete = "off", placeholder = "Search..." } = inputProps;
// placeholder shows selected item while open.
const inputPlaceholder = isOpen && selectedItemText ? selectedItemText : placeholder;
// value shows query when open, and query remains when closed if nothing is selected.
// if resetOnClose is enabled, then hide query when not open. (see handlePopoverOpening)
const inputValue = isOpen ? listProps.query : selectedItemText ?? (resetOnClose ? "" : listProps.query); Consider that However the nullish coalescing here
resultantly, the field always evaluates to empty string, even when it's supposed to render selectedItemText. Due to this, our front end does not pre-populate these text boxes on page load. (This was discussed on slack and ghe, will not link here). |
@ted-jenks for SA and collaboration |
Good catch; this certainly looks like a regression from Suggest. I don't have a v4 documentation link with a Suggest demo but you can see it working correctly in v3: https://blueprintjs.com/docs/versions/3/#select/suggest The regression is due to a bad port of this line from Suggest to Suggest2 (
|
Thank you @adidahiya @ted-jenks !! |
This can be seen on the Blueprint docs
Screen.Recording.2022-12-15.at.13.32.59.mov
The text was updated successfully, but these errors were encountered: