【问题标题】:Material UI IconButton tooltip is not shown correctlyMaterial UI IconButton 工具提示未正确显示
【发布时间】:2019-06-06 11:26:00
【问题描述】:

在我的 reactJS 应用程序中,我使用 Material UI 和 react-bootstrap-table。

在一个单元格中,我使用 Material UI IconButton,如下所示:

 <IconButton tooltip={t('tooltips:editRegulation')} tooltipPosition={'left'}
     onClick={() => this.props.history.push("/pms-records/edit/" + row.pmsFindingId)}>{cell}}>
     <FontIcon className="fa fa-pencil" aria-hidden="true"/>
 </IconButton>

结果是这样的:

工具提示被表格单元格边框剪切。我尝试更改 z-index 并阅读:https://github.com/mui-org/material-ui/issues/5912

但没有解决办法。

对我有什么提示吗?

提前致谢

【问题讨论】:

  • 你能提供一个可重现的 stackblitz 链接吗?

标签: css reactjs material-ui


【解决方案1】:

您的单元格肯定有一个显示overflow: hidden 的CSS。 您可以在portal 中呈现工具提示,但您最终会丢失元素的位置。 最好覆盖表格单元格 CSS

在 GitHub 链接问题中:

我通过将 style={ { overflow: 'visible' } } 添加到 IconButton 所在的 TableRowColumn。

【讨论】:

  • 问题仍然与控制表格单元格溢出的 CSS 有关,可能您的脚手架不一样,或者您没有正确覆盖 css。如果您有可访问的公共页面,我可以为您指出正确的方向
  • @ Mosè Raguzzini 我有同样的问题,我在容器中显示一个工具提示溢出:滚动和工具提示剪辑到容器的一侧,我如何覆盖溢出属性,有没有其他方式?
猜你喜欢
  • 1970-01-01
  • 2021-07-08
  • 1970-01-01
  • 1970-01-01
  • 2017-07-06
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-03-09
相关资源
最近更新 更多