I'm using the Tooltip
from Angular Material
and the tooltip doesn't display correctly on iOS (Safari). This is the behavior I experience:
- iPhone with iOS 12: long tap on the button shows the tooltip, but also executes the
click
event - iPad with iOS 13: no tooltip at all on long tap
- iPhone with iOS 14: tooltip is shown on long tap, but the popup menu (cut, copy, paste, ...) appears and a text below is selected
On Android everything is working as expected. Seems to me that the matTooltip
is not really working on iOS at all. This is my setup:
Angular CLI: 8.3.29
Angular: 8.2.14
@angular/cdk 8.2.3
@angular/material 8.2.3
My sample code is based on this here:
app.component.html
<button mat-raised-button
matTooltip="Info about the action"
aria-label="Button that displays a tooltip when focused or hovered over"
(click)="clickEvent()">
Action
</button>
app.component.css:
* {
-webkit-touch-callout: none;
-webkit-user-select: none; /* Disable selection/copy in UIWebView */
}
app.component.ts:
import { Component } from '@angular/core';
import {MatDialog, MatDialogConfig} from '@angular/material';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
title = 'tooltip';
constructor(private dialog: MatDialog) {}
clickEvent(){
window.alert('clicked');
}
}
app.module.ts:
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppComponent } from './app.component';
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
import {MatTooltipModule} from '@angular/material/tooltip';
import {MatButtonModule} from '@angular/material/button';
import {MatDialogModule} from '@angular/material';
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
NoopAnimationsModule,
MatTooltipModule,
MatButtonModule,
MatDialogModule
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
I tried to apply special CSS (see above), but that CSS must be applied in the different way to take effect. But still there are problems with elements, which are not selectable (e.g. in a form).
Is this a bug or am I missing something?