[Bug]: ComboBox does not display the full name for items with truncated text (eg.tooltip) when shouldFilterItem is true #18459
Labels
component: combobox
component: filterable-multiselect
role: dev 🤖
severity: 3
https://ibm.biz/carbon-severity
type: bug 🐛
Package
@carbon/react
Browser
Chrome
Package version
10.5.0
React version
18.2.0
Description
Using ComboBox from @carbon/react,
When the search box is empty, the item with truncated text shows the tooltip as expected.
However, when you type something in the search box, the tooltip stops showing.
Reproduction/example
https://stackblitz.com/edit/jwernaba-awct9mvr?file=src%2FApp.jsx
Steps to reproduce
load the above example,
type
e
in search box,the list should be filtered to 3 items.
hover over on the third one, no tooltip would be showing.
App.jsx as follows:
import React from 'react';
import { ComboBox } from '@carbon/react';
export default function App() {
const items = [
{
id: 'option-0',
text: 'An example option that is really long to show what should be done to handle long text',
},
{
id: 'option-1',
text: 'Option 1',
},
{
id: 'option-2',
text: 'Option 2',
},
{
id: 'option-3',
text: 'Option 3 - a disabled item',
},
{
id: 'option-4',
text: 'Option 4',
},
{
id: 'option-5',
text: 'Option 5 really long to show what should be done to handle long text',
},
];
const comboBoxFilterCallback =({
inputValue,
item,
itemToString,
}) => {
const label = item.text;
const searchLabel = label?.toLocaleLowerCase() || '';
};
return (
<div
style={{
width: 300,
}}
>
<ComboBox
id="carbon-combobox"
items={items}
itemToString={(item) => (item ? item.text : '')}
titleText="ComboBox title"
helperText="Combobox helper text"
onChange={() => {}}
shouldFilterItem={comboBoxFilterCallback}
downshiftProps= {
{isOpen: true}
}
/>
);
}
Suggested Severity
None
Application/PAL
No response
Code of Conduct
The text was updated successfully, but these errors were encountered: