There seems to be an issue with the functionality of Angular Material on iOS devices

I recently developed a website using Angular and Angular Material. While the site functions properly on Windows and Android across all browsers, I encountered an issue with iOS devices running Safari. Some elements on the page do not display correctly on iOS (although clicking on the page allows users to interact with input fields and log in successfully):

  • on Android:

https://i.stack.imgur.com/dXzCO.png

  • on iOS:

https://i.stack.imgur.com/dFDG9.png

The following is the HTML code snippet for the affected page:

 <div class="component-login">
  <div class="content">
    <div class="row">
      <div class="col-lg-12">
        <form name="loginForm" #f="ngForm" (ngSubmit)="logIn(f)">
          <div class="row  pl-4">
            <mat-form-field appearance="fill" class="full-width">
              <mat-label>Username</mat-label>
              <input  matInput required name="username" ngModel #username="ngModel"/>
            </mat-form-field>
          </div>
          <div class="row  pl-4">
            <mat-form-field appearance="fill" class="full-width">
              <mat-label>Password</mat-label>
              <input matInput required [type]="hide ? 'password' : 'text'" name="password" ngModel  #password="ngModel"/>
              <mat-icon matSuffix (click)="hide = !hide">{{hide ? 'visibility_off' : 'visibility'}}</mat-icon>
              <mat-error *ngIf="password.dirty">
                Error
              </mat-error>
            </mat-form-field>
          </div>
          <div class="row">
            <div class="center">
              <button mat-flat-button class="btn-save btn" [disabled]="!f.valid">Login</button>
            </div>
          </div>
        </form>
      </div>
    </div>

  </div>
</div>

Additional CSS styles used:

.component-login{
  height: 100%;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  .content{
    width: 400px;
    height: 400px;
    background: #e10600;
    margin: 0 auto;
    border-radius: 20px;
    position: fixed;
    top: 30%;
    @media screen and (max-width: 600px) {
      width: 90%;
    }
    img{
      margin: 60px 50px;
      @media screen and (max-width: 600px){
          margin: 60px 10px;
      }
    }
    .row{
      font-family: 'Titillium Web', sans-serif;
      color: #fff;
      .col-lg-12{

        padding: 0 50px;
        ::ng-deep .mat-form-field-flex{
          border-right: 5px;
          background-color: #fff;
        }
      }
      .center{
        display: flex;
        justify-content: center;
      }
      a{
        color: #fff;
        text-decoration: none;
        font-family: 'Titillium Web', sans-serif;
        img{
          width: 4%;
          margin: 0 10px 0 0;
        }
      }
      .mat-button-disabled{
        background-color:  #fff;
      }
      .btn-save{
        background-color: #fff;
        color: #000;
      }
    }
  }
}

Answer №1

My recommendation would be to implement the ios specific media query for a better user experience.

@supports (-webkit-touch-callout: none) {
   /* Apply CSS styles tailored for iOS devices */ 
}

Additionally, consider using a more responsive value for height and width attributes like `height: fit-content;`

height: fit-content;

You can find more information on media queries for standard devices at: https://css-tricks.com/snippets/css/media-queries-for-standard-devices/

Incorrect usage of col attributes may also contribute to this issue. Make sure you are utilizing the appropriate size that matches the dimensions of iOS devices (consider adjusting col-lg-12 and row pl-4 attributes).

Best of luck!

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Pattern matching for replacing <a> tags

As a beginner in the world of regular expressions, I am eager to learn more about it. Currently, my goal is to extract only the inner text from an HTML tag and remove the surrounding tags. For example: Original: Lorem ipsum <a href="http://www.google.e ...

Creating a navigation bar that smoothly slides into view from the top

In my Angular app (version 2+), the current code I have is: .header { background: rgba(white, 0); &.fixed-top { background: rgba(white, 1); border-bottom: solid whitesmoke 1px; position: fixed; top: 0; right: 0; left: 0; ...

Ways to display the page's content within a div container utilizing Jquery

I am attempting to display the content of a URL page (such as ) within a <div> using JQuery, but so far I have been unsuccessful. Here is an example of what I am trying to achieve: <div id="contUrl"> .. content of google.fr page </div> ...

Creating an Android application that integrates HTML styling efficiently

I currently have a social networking site with a mobile web version, and my goal is to package that view into an Android app and potentially enhance it with a custom splash screen. Essentially creating a branded browser window. If you have any tips or adv ...

What is the RxJS operator that corresponds to the combination of observableX and observableY being subscribed to asynchronously in a template?

In my component template, I currently have this code snippet: <mat-spinner *ngIf="((facade.user.data$.isLoading | async) || (facade.product.data$.isLoading | async))"></mat-spinner> My goal is to consolidate this union into a single ...

What is the best way to display a responsive website design exclusively for certain devices?

My website currently lacks responsiveness. Typically, we can check if a website is responsive by resizing the browser to see if it adjusts using CSS3 media queries. However, I am looking to create a better user experience by ensuring that visitors using a ...

Is there a way to use flexbox to decrease the size of images?

Struggling to make my code mobile-friendly. The PC version looks good, but on mobile, the bio stretches and text goes off the page. I can't seem to get the picture to shrink when viewed on a mobile device, or have the content neatly boxed alongside it ...

Tips for eliminating choices upon button press

How do I remove nested options inside a select element upon button click? I'm not sure where my mistake is, could it be in the for loop? var select = document.getElementById('colorSelect'); var options = document.getElementsByTagName(&ap ...

Exploring the World of Print CSS, Embracing Bootstrap, and Master

In continuation of my previous query, I am facing an issue with setting up a filemaker foreach loop to display a group of images along with their names and IDs, accompanied by checkboxes. Upon checking the relevant checkboxes, the corresponding images are ...

A guide on using jQuery to iterate through 3 separate div elements

Seeking assistance with creating a dynamic loop for multiple divs (3 or more) using jQuery. The desired outcome is to have the main image div on the homepage rotate with other divs, changing both the background image and links within each div. I initially ...

Unexpected lack of tree shaking in Angular AOT compiled application

I am developing a module called MyCommonModule that consists of common components, services, etc. This module is designed to be shared across multiple Angular applications. Here is an example of a basic app that imports MyCommonModule, without directly re ...

`how to insert finished HTML & CSS header into WordPress PHP documents`

After dedicating countless hours to studying, I still can't figure out how Wordpress will locate and utilize my alternate header. The code snippet below served as a helpful starting point: <!--?php /* */ if(is_page(23)) { get_header('about&a ...

The issue of Java Selenium driver.close() not functioning properly on Safari for iPhone

As a newcomer to selenium automation, I am currently working on automating tests for our website using iPhone Safari. The tests involve actions like clicking an element and then closing the newly opened Safari tab. While I was able to successfully click o ...

Ensure the Json object contains an integer

I am facing an issue where I receive a Json data in dictionary format. Below is a sample json: Receivedtext: { "x": "pricef", "b": "usd", "ds": [ "tpr", "avgp", "mcap", "ppc7D", "ppc12h", "ppc4h", "ppc24h" ], "data": ...

Creating a table with merged (colspan or rowspan) cells in HTML

Looking for assistance in creating an HTML table with a specific structure. Any help is appreciated! Thank you! https://i.stack.imgur.com/GVfhs.png Edit : [[Added the headers to table]].We need to develop this table within an Angular 9 application using T ...

Assign a value to the input field based on changes made in another input field

I am brand new to the world of JavaScript and currently grappling with setting a value in an input field based on the onchange event of another input field. Here is my code sample for input field 1: <input type='text' onchange='methodTh ...

The failure of an Angular2 HTTP GET request with a header

Attempting to make a simple get request using angular2 http, like this: (including the token retrieved from a post to my api) let idToken = localStorage.getItem('id_token'); let authHeader = new Headers(); if (idToken) { authHeader.append(&a ...

Failure to connect HTML and CSS files

My HTML and CSS files are not linking even though they are in the same folder. Here is my HTML code: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatibl ...

Using Kendo PanelBarItem to incorporate a personalized component as a child element

I was looking to design a component with PanelBarItems in its template. However, I'm facing issues and it doesn't seem to be working. Any suggestions? Main Component: import { Component } from '@angular/core'; @Component({ selecto ...

Achieve consistent column heights with flexbox styling

I have a solution for achieving equal height columns using the CSS property display:table. Here is an example: .row { display: table; width: 100%; } .col{ display: table-cell; } However, in my case, I am using flexbox and the row class has ...