-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ariaLabel doesn't disable <title> tag on IonIcons 5 #838
Comments
While I don't mind the title tag being there, I do mind the tooltip that browsers show. I do my own tooltips with bootstrap/popper on links containing the icons, so they're just additional clutter and even show wrong information (like "create" when I use that icon to edit something). |
The |
I am sure there is a better way, but this is a clunky workaround I am using:
|
@quinlo Thanks, looks good. When/where do you call this function? |
you can made a directive and do this: then, you can use it in your ion icon in this way |
I extended the directive so you can provide an alternative title: import { Directive, ElementRef, Input } from '@angular/core';
@Directive({
selector: '[ioniconRemoveTitle]',
})
export class IoniconsRemoveTitleDirective {
@Input('iconTitle') iconTitle: string;
constructor(private el: ElementRef) {
// Doing nothing.
}
ngOnInit(): void {
const removeTitle = () => {
if (
this.el.nativeElement &&
this.el.nativeElement.shadowRoot &&
this.el.nativeElement.shadowRoot.querySelector('.icon-inner svg title')
) {
this.el.nativeElement.shadowRoot.querySelector('.icon-inner svg title').innerHTML =
this.iconTitle || '';
} else {
setTimeout(() => {
removeTitle();
}, 500);
}
};
removeTitle();
}
} Use it like this ( <ion-icon name="close-circle" ioniconRemoveTitle [iconTitle]="'New title for close button'"></ion-icon> |
+1 for workaround, but I'd like to cast my vote for some built-in functionality to remove and edit the tooltip. There are 2 or 3 other issues looking for the same thing. |
I think it makes more sense to populate the Having it hard coded like this at build time makes it hard to customizing the title that appears on I found a line of code that seems to adds the Lines 169 to 172 in 8c2a507
|
Yup, not ideal that this functionality isnt supported out of the box. Since displaying the icon name on icon hover event is actually often worse than displaying nothing at all (e.g. "Create" is displayed when operation is an Edit), probably better to just disable displaying icon title via |
+1 for a built-in fix for this. As @ariscol mentioned, there are several other issues on this repo talking about the same thing: @liamdebeasi Is this something we can get changed? I'm sure someone here could make a PR with this change. Would that be considered for merging? |
@quinlo your solution is awesome, but it didn't work for me. I am stuck at the |
This CSS-only solution fixed it for me and works great and very simple, however, I would love to see this properly implemented in a future version. |
Hi everyone, Wanted to provide a quick update. We plan on removing the default |
Just as an idea when would the next major release roll out? Thanks |
We do not have a time estimate at the moment, but I will update this thread when I have more to share. |
Okay, hope it'll be soon. I'm loving the simplicity of ionicons 😀 |
I see that ionicons has published 6.1.0-0 to NPM. Trying it out the title tag still shows up causing the tooltip. Is this supposed to be removed in 6.1 and if so is there an ETA on when that will be included? This is what I'm looking forward to most in the next update is removing these tooltips. |
Thanks for the report. This has been resolved via #1166 and a fix will be available in Ionicons 6.1. In this release, the |
Hello @liamdebeasi Will there be an update of the library in ionic-framework soon, or in the next patch version? Thanks! |
Yes, we plan on updating the dependency in an upcoming minor release of Ionic Framework: ionic-team/ionic-framework#26617 Note: This PR only updates the dependency for icons that are used internally (such as the icon for |
Perhaps I'm missing something, but I can't seem to get the <title> tag to stop appearing on ionicon v5 objects. When you mouseover them on desktop they give the icon name instead of the title/aria-label assigned to the ionicon object. I tried ariaLabel and aria-hidden, but neither seem to make any difference. Everything is working fine on v4.5.10_0.
The text was updated successfully, but these errors were encountered: