Tooltip is not showing when show-tooltip is set to true on ui5-icon
Tooltip is not showing when show-tooltip is set to true on ui5-icon
Expected behavior
When using ui5-icon as:
<ui5-icon class="ui5-button-icon" name="action-settings" show-tooltip="true" ></ui5-icon>
Tooltip should be visible when show-tooltip is set to true.
Actual behavior Tooltip does not show.
Screenshots
Priority: (optional) (Medium)
Hello @gurkirpalgill
Only 4 icons (message-error/warning/information/success) out of 600 has built in tooltips. To have a tooltip for your icon, pass the desired text via the accessible-name attribute.
We will update the showTooltip docs to make it clear.
Best, ilhan
icon is shown through the ui5-button, so I do not have direct access to the icon itself. if i set accessible-name on button, it does not work.
<ui5-button design="Transparent" icon="decline" ref={declineRef} accessible-name="Close" slot="endButton" onClick={() => removeUserEvent(i)}></ui5-button>
I am able to set the accessible-name programmatically but it its not ideal.There should be a declarative option to set the accessible-name through the button itself if it's setting the icon. Right now I have to do something like this:
useEffect(() => {
if (!declineRef.current) {
return;
}
const setTooltip = async () => {
await RenderScheduler.whenFinished();
const shadow = declineRef.current.shadowRoot;
if (shadow.querySelector("ui5-icon")) {
shadow.querySelector("ui5-icon").setAttribute("accessible-name", "Close");
}
}
setTooltip();
});
Providing an attribute e.g. icon-accessible-name that sets the icon tooltip is desirable:
<ui5-button design="Transparent" icon="decline" ref={declineRef} icon-accessible-name="Close" slot="endButton" onClick={() => removeUserEvent(i)}></ui5-button>
@ilhan007 when do you think the fix will be available ?
The icon-accessible-name="Close" is not an API that we would like to have, I would suggest trying: and perhaps use some styles, if something is not perfectly centred:
<ui5-button>
<ui5-icon accessible-name="Close" name="decline">
</ui5-button
Hi @gurkirpalgill
As much as I can understand from your issue, you need a tooltip for icon only button. If this is the case, I think that the following PR might be exactly what you need.
Closing due to inactivity. You can reopen the issue anytime if you have additional input.