Skip to content

[MarkdownEditorHelpButton] Add optional tooltipPosition#9546

Open
Zacqary wants to merge 3 commits intoelastic:mainfrom
Zacqary:markdown-tooltip-position
Open

[MarkdownEditorHelpButton] Add optional tooltipPosition#9546
Zacqary wants to merge 3 commits intoelastic:mainfrom
Zacqary:markdown-tooltip-position

Conversation

@Zacqary
Copy link
Copy Markdown
Contributor

@Zacqary Zacqary commented Mar 31, 2026

Summary

Adds an optional tooltipPosition to the EuiMarkdownEditorHelpButton.

This is needed for the Dashboard markdown editor, as we put the help button on the header and use a floating Edit/Preview toggle.

In elastic/kibana#253431 we're adding a Settings button, which we can successfully assign position: bottom:

Screenshot 2026-03-31 at 3 10 26 PM

But we can't do the same for the help button:

Screenshot 2026-03-31 at 3 42 08 PM

An undefined tooltipPosition defaults to top, so this change will have no impact on other uses of the help button.

Copilot AI review requested due to automatic review settings March 31, 2026 20:43
@Zacqary Zacqary requested a review from a team as a code owner March 31, 2026 20:43
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds an optional tooltipPosition prop to EuiMarkdownEditorHelpButton so consumers (e.g., Dashboard’s markdown editor header layout) can control where the help tooltip renders without affecting existing usages (default remains top).

Changes:

  • Extends EuiMarkdownEditorHelpButton props with optional tooltipPosition?: ToolTipPositions
  • Wires the new prop through to EuiToolTip’s position prop

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown
Contributor

@weronikaolejniczak weronikaolejniczak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @Zacqary! Awesome to see you contribute to our lib, very happy about that! 💚

The ask is legitimate, the code is straightforward. Changelog is ok. Prop tables in docs will be automatically populated, no need to add docs about this.

The 3 concerns I have:

Prop name

Customarily in EUI we use e.g. <component>Props pattern, e.g. badgeProps, tooltipProps and spread them on the component. For tooltip specifically, we could omit content and children in the type and put content={syntaxTitle} after the spread.

Note: please use tooltipProps and not toolTipProps. It's "tooltip", one word.

Only works for standalone usage

I understand this will work for your use case where you render EuiMarkdownEditorHelpButton directly. But we need to consider the bigger picture.

If we do allow the position to be changed from the help button, we should likely allow it to be changed from EuiMarkdownEditor level as well (similarly as was done with toolbarProps before). It could look like:

footerProps?: {
  helpButtonProps?: Pick<EuiMarkdownEditorHelpButtonProps, 'toolTipProps'>;
};

That would be the more consistent, complete API.

What for...?

Isn't a simpler solution just rendering that tooltip always to the bottom? That requires a design decision though.

@Zacqary
Copy link
Copy Markdown
Contributor Author

Zacqary commented Apr 1, 2026

@weronikaolejniczak

Customarily in EUI we use e.g. Props pattern, e.g. badgeProps, tooltipProps and spread them on the component. For tooltip specifically, we could omit content and children in the type and put content={syntaxTitle} after the spread.

Got it, I saw tooltipPosition used in packages/eui/src/components/badge/beta_badge/beta_badge.tsx but I guess that's violating convention. I'll fix.

Only works for standalone usage
I understand this will work for your use case where you render EuiMarkdownEditorHelpButton directly. But we need to consider the bigger picture.
Isn't a simpler solution just rendering that tooltip always to the bottom? That requires a design decision though.

By default, EuiMarkdownEditor renders the EuiMarkdownEditorHelpButton in its footer. In this case, we do want the tooltip to have a top position.

In our use case, we disable the footer and move the button to the header, which warrants the position change.

I think it's unlikely anyone would want to change the tooltip position if they're putting the button in the footer. Happy to add this footerProps change if you still think it's necessary, but I just want to confirm.

@elasticmachine
Copy link
Copy Markdown
Collaborator

💚 Build Succeeded

History

@elasticmachine
Copy link
Copy Markdown
Collaborator

💚 Build Succeeded

History

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants