flarum/framework · warning

`title` attribute was passed to Tooltip component. Was this…

Error message

`title` attribute was passed to Tooltip component. Was this intentional? Tooltip content should be passed to the `text` attr instead.

What it means

The Mithril Tooltip component warns (console.warn) when a `title` attribute is passed in its attrs, since Tooltip expects its content via the `text` attr; passing `title` almost always means a mistake (native title behavior) or duplicated tooltip text.

Solutions

  1. Rename the attribute from title to text in the JSX/ hyperscript call
  2. If the title is intentionally separate, pass it to the surrounding element instead
  3. Suppress deliberately via ignoreTitleWarning only for legacy code

Example fix

// before
<Tooltip title="Delete item">
// after
<Tooltip text="Delete item">
Defensive patterns

Strategy: type-guard

Validate before calling

// lint rule or helper
function assertTooltipAttrs(attrs) {
  if ('title' in attrs) throw new Error('Use `text`, not `title`, for Tooltip');
}

Type guard

function usesTitleAttr(attrs) {
  return attrs != null && Object.prototype.hasOwnProperty.call(attrs, 'title');
}

Prevention

When it happens

Trigger: Rendering <Tooltip title="..."> (or attrs.title) in any Mithril view; the warning is emitted once per flag unless ignoreTitleWarning is set.

Common situations: Copy-pasting button markup that used the native HTML title attribute into a Tooltip component, or confusing `title` with `text` in the component API.

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


AI-assisted analysis of flarum/framework@4b939f6853 (2026-09-15). Data as JSON: /api/errors/af76c853e407fdc0. Report an issue: GitHub.

Appendix: source

Thrown at framework/core/js/src/common/components/Tooltip.tsx:140

     * vnode is a component, not a text or trusted HTML vnode.
     */
    const children = vnode.children as Mithril.ChildArray | undefined;

    // We remove these to get the remaining attrs to pass to the DOM element
    const {
      text,
      tooltipVisible,
      showOnFocus = true,
      position = 'top',
      ignoreTitleWarning = false,
      html = false,
      delay = 0,
      container = false,
      ...attrs
    } = this.attrs;

    if ((this.attrs as any).title && !ignoreTitleWarning) {
      console.warn(
        '`title` attribute was passed to Tooltip component. Was this intentional? Tooltip content should be passed to the `text` attr instead.'
      );
    }

    const realText = this.getRealText();

    // We need to update the tooltip text if it has changed
    if (realText !== this.oldText) {
      this.oldText = realText;
      this.shouldUpdateText = true;
    }

    if (tooltipVisible !== this.oldVisibility) {
      this.oldVisibility = this.attrs.tooltipVisible;
      this.shouldChangeTooltipVisibility = true;
    }

    // We'll try our best to detect any issues created by devs before they cause any weird effects.

View on GitHub (pinned to 4b939f6853)