react-virtualized icon indicating copy to clipboard operation
react-virtualized copied to clipboard

"[object Object]" appearing in tooltip when hovering column header

Open Baloche opened this issue 7 years ago • 2 comments

Hello, I think I'm facing an issue : when I put a React element in the label prop of a column, the tooltip "[object Object]" appears when I the cursor is hovering the column header :

<Table /* ... props */>
    <Column
      label={<LocalizedText id="WEB_LAST_MEASUREMENT" />}
      /* ... other props */
    />
</Table>

After inspecting the node, I can see that the span element in the header has its prop title containing the react element I declared as the label :

{
  children: {…},
  className: "ReactVirtualized__Table__headerTruncatedText",
  title: {,
    $$typeof: Symbol(react.element),
    _owner: FiberNode{…},
    _store: {…},
    key: null,
    props: {…},
    ref: null,
    type: LocalizedText()
  }
}

I think I can fix that by giving the Column a custom headerRenderer prop, but I don't think that's the expected behaviour. Or am I doing something wrong ?

Baloche avatar Jul 20 '18 08:07 Baloche

[EDIT] are you doing something like: const page = { title: 'some title' } ... <Page {...page}/> ...

Cos if you do: you are passing title attribute which is responsible for the tooltip content

ingvardm avatar Dec 19 '18 10:12 ingvardm

You can try like this

ReactDOMServer.renderToString(<LocalizedText id="WEB_LAST_MEASUREMENT" />)

BykovDenis avatar Jun 10 '21 10:06 BykovDenis