{"record":{"id":"af76c853e407fdc0","repo":"flarum/framework","slug":"title-attribute-was-passed-to-tooltip-component-was-this","errorCode":null,"errorMessage":"`title` attribute was passed to Tooltip component. Was this intentional? Tooltip content should be passed to the `text` attr instead.","messagePattern":"`title` attribute was passed to Tooltip component\\. Was this intentional\\? Tooltip content should be passed to the `text` attr instead\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"framework/core/js/src/common/components/Tooltip.tsx","lineNumber":140,"sourceCode":"     * vnode is a component, not a text or trusted HTML vnode.\n     */\n    const children = vnode.children as Mithril.ChildArray | undefined;\n\n    // We remove these to get the remaining attrs to pass to the DOM element\n    const {\n      text,\n      tooltipVisible,\n      showOnFocus = true,\n      position = 'top',\n      ignoreTitleWarning = false,\n      html = false,\n      delay = 0,\n      container = false,\n      ...attrs\n    } = this.attrs;\n\n    if ((this.attrs as any).title && !ignoreTitleWarning) {\n      console.warn(\n        '`title` attribute was passed to Tooltip component. Was this intentional? Tooltip content should be passed to the `text` attr instead.'\n      );\n    }\n\n    const realText = this.getRealText();\n\n    // We need to update the tooltip text if it has changed\n    if (realText !== this.oldText) {\n      this.oldText = realText;\n      this.shouldUpdateText = true;\n    }\n\n    if (tooltipVisible !== this.oldVisibility) {\n      this.oldVisibility = this.attrs.tooltipVisible;\n      this.shouldChangeTooltipVisibility = true;\n    }\n\n    // We'll try our best to detect any issues created by devs before they cause any weird effects.","sourceCodeStart":122,"sourceCodeEnd":158,"githubUrl":"https://github.com/flarum/framework/blob/4b939f685389bfe8a380e9e28ddf305a1c66950c/framework/core/js/src/common/components/Tooltip.tsx#L122-L158","documentation":"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.","triggerScenarios":"Rendering <Tooltip title=\"...\"> (or attrs.title) in any Mithril view; the warning is emitted once per flag unless ignoreTitleWarning is set.","commonSituations":"Copy-pasting button markup that used the native HTML title attribute into a Tooltip component, or confusing `title` with `text` in the component API.","solutions":["Rename the attribute from title to text in the JSX/ hyperscript call","If the title is intentionally separate, pass it to the surrounding element instead","Suppress deliberately via ignoreTitleWarning only for legacy code"],"exampleFix":"// before\n<Tooltip title=\"Delete item\">\n// after\n<Tooltip text=\"Delete item\">","handlingStrategy":"type-guard","validationCode":"// lint rule or helper\nfunction assertTooltipAttrs(attrs) {\n  if ('title' in attrs) throw new Error('Use `text`, not `title`, for Tooltip');\n}","typeGuard":"function usesTitleAttr(attrs) {\n  return attrs != null && Object.prototype.hasOwnProperty.call(attrs, 'title');\n}","tryCatchPattern":null,"preventionTips":["Use the `text` attr exclusively for Tooltip content","Add an ESLint/TS rule flagging title on Tooltip","Wrap Tooltip in a project-local component that omits title from its API"],"tags":["javascript","mithril","component-api","deprecated-api"],"backgroundTag":"invalid-argument-value","analyzedSha":"4b939f685389bfe8a380e9e28ddf305a1c66950c","analyzedAt":"2026-09-15T18:09:20.879Z","contentChangedAt":"2026-09-15T18:09:20.879Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}