-
Notifications
You must be signed in to change notification settings - Fork 8.5k
Description
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.
Lines 90 to 92 in b531427
| if (!panelDescription) { | |
| return panelTitleElement; | |
| } |
Lines 114 to 137 in b531427
| {!hideTitle ? ( | |
| <h2 | |
| // styles necessary for applying ellipsis and showing the info icon if description is present | |
| css={css` | |
| overflow: hidden; | |
| `} | |
| > | |
| <EuiScreenReaderOnly> | |
| <span id={headerId}> | |
| {panelTitle | |
| ? i18n.translate('presentationPanel.ariaLabel', { | |
| defaultMessage: 'Panel: {title}', | |
| values: { | |
| title: panelTitle, | |
| }, | |
| }) | |
| : i18n.translate('presentationPanel.untitledPanelAriaLabel', { | |
| defaultMessage: 'Untitled panel', | |
| })} | |
| </span> | |
| </EuiScreenReaderOnly> | |
| {panelTitleElement} | |
| </h2> | |
| ) : null} |
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:
- create a dashboard with two panels, one with just the title, the other with title and description
- add a custom h2 style with font-size: 40px or more
- 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):
