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

Automatically adjust the model input (Signal) based on the parent and respond to any alterations in the children

Within my Angular 16 application, I have a parent component that passes a plain JavaScript object (myObj) to a child component, where it is treated as a model<MyObj>. <!-- parent.component.html --> <app-children [myObjModel]="myObj&qu ...

Why are UI changes delayed when using Angular2 Google Maps events?

I am working on an Angular2 application that integrates the Google Maps JS API. When loading Google Maps, I include the script like this: <script src="https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY"></script> To listen to events on ...

The presence of catchError() within the pipe() function will display an error specifically at the .subscribe stage

I encountered an issue while trying to handle errors for a method in Angular. After adding a catchError check using the .pipe() method, I noticed that the variable roomId was marked with a red squiggly line. The error message read: TS2345: Argument of type ...

Encountering a net::ERR_EMPTY_RESPONSE error while trying to use the DELETE Method in Angular 4

I have been using the following method to delete data: return this.http.delete(this.ApiURL, new RequestOptions({headers: headers,body: body })) .map((res: Response) => res.json()); However, I encountered the net::ERR_EMPTY_RESPONSE error. Interestingl ...

Reduce the line length for better readability

Looking for a way to make a button with flexible width while allowing text to wrap to 2 lines for minimum button size? Check out the examples below: To keep the button width small, even short words should wrap to 2 lines: My Button If there's a ...

Concealing the BottomNavigation bar in Nativescript

Currently using Nativescript 7+ and seeking to implement a feature where the TabStrip can be hidden on certain pages post navigation. Below is the relevant section of my .html code. <BottomNavigation id="bottomNav"> <TabStrip> ...

Angular: utilizing two ngFors to target and update specific sections of the DOM

I'm facing a challenge and unsure if it's achievable in Angular. Below is a simple HTML code snippet: <div > <div *ngFor="let item of apiNames, let i = index" class="rescontainer"> <div class="resbox headline"> ...

Leveraging RadChart dynamically within your application, without relying on HTML

Currently, I am in the process of developing a cross-platform native mobile app for Android and iOS using NativeScript and Angular. The charting engine I am utilizing is RadChart from Telerik. However, I am facing a challenge as I want to use these charts ...

Looking for assistance with a straightforward CSS opacity fix for Internet Explorer

Take a look at this page comparison between chrome and IE. On the right side, you'll notice drop down fields. While Chrome displays them correctly, IE shows rectangular boxes instead. To fix this issue, I added opacity to the select fields with the ...

A Guide to Filtering MongoDB Data Using Array Values

I am trying to extract specific data from a document in my collection that contains values stored in an array. { "name": "ABC", "details": [ {"color": "red", "price": 20000}, {" ...

What causes the circular progress bar to disappear when hovering over the MUI React table?

My goal was to create a table with a CircularProgressBar that changes its background color from orange to dark blue when hovering over the row. However, despite my efforts, I couldn't get it to work as intended. Additionally, I wanted the progressBar ...

Adding text to a horizontal scrolling element causes the parent div to be pushed downwards

Can anyone help me understand why inserting text into one of the divs in a horizontally scrolling div causes the parent div to move downward? Looking for suggestions! @import url('https://fonts.googleapis.com/css?family=Hind:300,400,500,600,700&apo ...

Updating the PHP form to include functionality for a reset button and adjusting the logic for

Having some difficulties with my PHP form. I created a simple form that consists of the following logic: if (isset($_POST['submit'])) { } elseif (isset($_POST['confirm'])) { } else { } The form includes a submit button, followed by a ...

Make a <div> element that has a fixed size, but allows for scrolling text inside

I have tried searching the forum for a solution to my problem, but haven't found one yet. I am trying to create two "divs" with fixed height and internal scrolling. However, whenever I add text inside one of them, its height increases accordingly. Wha ...

The lower border is unresponsive in the CSS/HTML code currently in use

Currently diving into the world of Web Development, I find myself tackling the CSS part. My latest challenge involves adding a bottom border to an element, but no matter what I try, the border just won't show up. I've scoured resources for soluti ...

Troubleshooting issues with the sidebar navigation in Laravel project using Vue and AdminLTE

I successfully installed AminLte v3 via npm in my Laravel + vue project and everything is functioning properly. However, I am facing an issue when I attempt to click on the main menu item in the Side navbar that is labeled as <li class="nav-item has-tr ...

Transferring information from a child to parent component within Angular using the <router-outlet> component

I currently have the following code in my app.component.html file: <div> <app-login (un)="doSth($event)"></app-login> </div> <router-outlet (un)="doSth($event)"></router-outlet> And in my app.com ...

Is there a way to prevent Chrome from highlighting text that matches the content of a `position: fixed` element?

I currently have a Toc element in my HTML with the property position: fixed. (This means it remains in place as you scroll) My goal is to prevent Chrome's Find Text feature from recognizing text within that Toc element. (Ideally using JavaScript) ...

Flutter - The 'parent != 'null' is not valid' error message is common when using the Navigator widget

I recently wrote a code that checks for a certain condition and should navigate to the next page if that condition is true. However, every time the condition returns true, I encounter an error instead of being able to navigate. class BuyTickets extends St ...

Guide to modifying WordPress version 4.5 with HTML pages

I am encountering issues with my Wordpress website. I have installed it on Softcald in cPanel and now I want to edit my Wordpress using HTML. However, I am having trouble finding the editing option. My Wordpress version is 4.5 and I have searched online ...