UI5 / UI5/openui5

Extended `sap.ui.core.TooltipBase`: delegate event handlers tightly coupled with the tooltip owner

Open
#3,168 5 comments 0 reactions 1 assignee View on GitHub

@AndreHofeditz is already working on this.

Since Mar 23, 2026.

bug in progress
Dominant language
JavaScript
Stars
3.3k
Forks
1.3k
PR merge metrics
No merged PRs in 30d

Description

Recently I discovered that:

  • Framework hooks, such as onlocalizationChanged and onThemeChanged, are triggered twice.
  • Other pseudo or browser events, such as onfocusin, are handled in the custom tooltip control for the tooltip owner control as well.

URL (minimal example if possible)

https://embed.plnkr.co/33zFqa?show=control%2FTooltip.js,preview

Steps to reproduce the problem:

  1. Open the above sample.
  2. Right-click on the preview and inspect the element to open the browser console.
  3. Enter
    • Either sap.ui.getCore().applyTheme("sap_belize"); in order to trigger onThemeChanged
    • Or sap.ui.getCore().getConfiguration().setLanguage(<lang-code>); in order to trigger onlocalizationChanged.

Any other information? (attach screenshot if possible)

When a tooltip is being set, the parent control calls _refreshTooltipBaseDelegate:

https://github.com/SAP/openui5/blob/310f072a062e5a2908df23a07946edccfb1682d8/src/sap.ui.core/src/sap/ui/core/Element.js#L926-L932

In _refreshTooltipBaseDelegate, the tooltip instance itself is added as a degelate (this.addDelegate(oTooltip)):

https://github.com/SAP/openui5/blob/310f072a062e5a2908df23a07946edccfb1682d8/src/sap.ui.core/src/sap/ui/core/Element.js#L900-L911

This causes triggering the hooks twice in _handleEvent when, for example, the theme has changed:

https://github.com/SAP/openui5/blob/310f072a062e5a2908df23a07946edccfb1682d8/src/sap.ui.core/src/sap/ui/core/Element.js#L306-L342

Given sHandlerName === "onThemeChanged":

  1. In this[sHandlerName]() whereas this === the custom tooltip control
  2. In oDelegate[sHandlerName].call(/*...*/) whereas that === the tooltip owner control

Why is the tooltip object added as a delegate in the first place? That was not clear from the source code.
It would be nice if the hooks could be triggered only once, and other on... event handlers working independently from the tooltip owner control.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.