elastic/kibana

[Dashboard] Missing panel title h2 style

已关闭

#239,708 创建于 2025年10月20日

 (3 条评论) (0 个反应) (0 位负责人)TypeScript (8,021 个派生)batch import
Feature:DashboardTeam:Presentationbuggood first issueimpact:lowloe:small

仓库指标

星标
 (19,065 个星标)
PR 合并指标
 (平均合并 1天 16小时) (30 天内合并 999 个 PR)

描述

Kibana version: 8.x, 9.x

Describe the bug:

An h2 element is wrapping the panel title when the panel has a description, when not it just uses the panelTitleElement.

https://github.com/elastic/kibana/blob/b5314276e7299f16b170d91b20ec5e07a52a3160/src/platform/plugins/private/presentation_panel/public/panel_component/panel_header/presentation_panel_title.tsx#L90-L92

https://github.com/elastic/kibana/blob/b5314276e7299f16b170d91b20ec5e07a52a3160/src/platform/plugins/private/presentation_panel/public/panel_component/panel_header/presentation_panel_title.tsx#L114-L137

This h2 doesn't own its style, but is inherited. Unfortunately a style override (from a browser extensions for example) at the body/html level could wrongly updates the font-size of this header causing the title to be larger then the required size. EUI doesn't block this behaviour and the h2 is not styled to prevent that.

Steps to reproduce:

  1. create a dashboard with two panels, one with just the title, the other with title and description
  2. add a custom h2 style with font-size: 40px or more
  3. you will notice that the panel with description increases in font-size.

Expected behavior: It should behave as every other h2 elements aka EuiTitles and it should not be overwritten by custom styles.

Also the other wrong fact is that it has semantically a different meaning then the title without the description that is just a link or a span if in read-only mode.

Screenshots (if relevant):

贡献者指南