Issue with iOS 10: Changes to class not reflected in CSS/styles

Currently, I am utilizing Ionic with Angular to develop an application for Android and iOS. Surprisingly, everything functions smoothly on Android, but there seems to be an issue with iOS.

I am employing a class change on an element using ng-class. I can observe the class change in the HTML and CSS within the Safari inspector, yet the changes are not reflected on the screen. The only way I can visualize the modification is if I manually adjust the CSS selector (even as simple as toggling a style on/off).

Below is the snippet of HTML with Angular:

<div class="avatar-view__initial__question question-hide" ng-class="{'question-show': speech.captured === true, 'question-hide': speech.captured === false}">{{question.text}}</div>

And here is the CSS:

  .avatar-view__initial__question {
    text-align: left;
    background-color: #E9EBEF;
    font-size: 1.5em;
    position: relative;
    background-image: url(../img/icons/icon-ear.svg);
    background-size: 50px;
    background-repeat: no-repeat;
    background-position: 10px center;
    flex-shrink: 1;
    @extend .css-animate;

    &.question-show {
      padding: 20px 10px 20px 60px;
      height: auto !important;
    }
    &.question-hide {
      height: 0 !important;
      padding: 0 10px 0 60px;
    }
  }

Although the CSS styling is indeed being implemented, the changes remain unseen until I manipulate any style related to the element in the inspector.

Could this be a bug, or is there a workaround that I can implement?

UPDATE: After testing on an iOS 9 device, the functionality works flawlessly. The issue appears to be specific to iOS 10.

UPDATE 2: It seems like a potential flexbox problem. Originally, I had the elements filling the screen as a column, but encountered issues with the bottom one having zero height when there was no content. I restructured the HTML to resolve the issue, but I wanted to share this in case others are facing a similar problem.

Answer №1

It appears that the issue at hand revolves around the iOS 10 webview failing to re-render the template, despite the class being correctly updated and applied.

Our goal here is to trigger a re-render of the template whenever the class is updated. We have observed that the class changes every time the object member speech.captured changes its value.

To address this, we can ensure a re-render occurs whenever this value changes by including a conditionally rendered empty span in the following manner:

<span *ngIf="speech.captured"></span>

<div class="avatar-view__initial__question question-hide" ng-class="{'question-show': speech.captured === true, 'question-hide': speech.captured === false}">{{question.text}}</div>

Answer №2

It could potentially be related to the issue of browser caching. You may want to attempt disabling the caching feature and see if that resolves the problem.

Answer №3

give this a shot

.custom-avatar__question {
   text-align: left;
   background-color: #E9EBEF;
   font-size: 1.5em;
   position: relative;
   background-image: url(../img/icons/icon-ear.svg);
   background-size: 50px;
   background-repeat: no-repeat;
   background-position: 10px center;
   flex-shrink:1;
   @extend .css-animate;
 }

.custom-avatar__question.question-display {
   padding: 20px 10px 20px 60px;
   height: auto !important;
 }
.custom-avatar__question.question-hide {
   height:0 !important;
   padding:0 10px 0 60px;
 } 

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

How to verify the parent nodes in a jstree

I have implemented a two state jstree. However, I am encountering an issue where it is not possible to select any other node in relation to a node. My goal is that when I click on a specific node, all of its parent nodes should also be checked. Any assist ...

Navigating from ASP.NET Core Web API to Angular: Redirecting seamlessly

Seems like I am facing an issue with Angular redirection within ASP.NET Core Web API in a shared deployment scenario. I am using ASP.NET Core 7 for the Web API, which was working fine with ASP.NET Core 6. Here is the build files structure captured in a sc ...

Populate UIPickerView with nested array in JSON format

Each object in the sites array of the JSON Data has its own array called "categories," structured like this: "sites": [ { "nid": "25109", "name": "guard.com", "url": "http:\/\/www.trial.com\/guard\/", "description": null, " ...

In order to work with the optionSelectionChanges property of the MdSelect directive in Angular Material2, it

Within my application, there is a Material2 select dropdown widget containing several options. app.component.html <md-select placeholder="Choose an option" [(ngModel)]="myOption" (optionSelectionChanges)="setOptionValue(myOption)"> &l ...

Styling a component next to another using CSS

Struggling with a simple question here. I'm experimenting with HTML and CSS, trying to create a page with a central content box flanked by two arrow images on each side. While the concept isn't too difficult, I'm running into issues with usi ...

What is the best way to retrieve JSON data responses in Objective-C?

I am sharing my information via URL using the following code block. NSString *urlString = [NSString stringWithFormat:@"company_name=%@&email_id=%@&password=%@",_CompanyName.text,_Email.text, _Password.text]; NSString *postLength = [NSString string ...

The <g> tag fails to properly render within the <svg> element in Firefox

When running an Angular 6 application with ES6-style D3js modules, there are some issues on Firefox (Chromium, Chrome, Safari, and IE Edge work fine). Below is a sample of pseudo code (full production code is available below): <svg width="500" height=" ...

Angular is able to successfully retrieve the current route when it is defined, but

Here's the code snippet I am working with: import { Router } from '@angular/router'; Following that, in my constructor: constructor(router: Router) { console.log(this.router.url); } Upon loading the page, it initially shows the URL a ...

Deciding between bundling a Typescript package and using tsc: When is each approach the best choice

When it comes to publishing a Typescript NPM package (library, not client), I have two main options: 1. Leveraging Typescript's compiler First option is to use the Typescript compiler: tsc and configure a tsconfig.json file with an outDir setting: { ...

Adding embedded binaries from other projects to project dependencies in Xcode is not permitted

My XCode workspace was set up using XCode 6.0.1 with 2 Swift libraries and one iOS app (Swift) that relies on these libraries. I had a smooth setup which allowed me to run the iOS app on both iPhones and simulators: The 2 library projects were added as Emb ...

Text alignment in a UITableViewCell with a combination of accessory views

In my UITableViewCell, I have a unique background image and the text is centered within the cell. Some rows have the UITableViewCellAccessoryDetailDisclosureButton to indicate additional details for that specific row. The issue arises when using this acce ...

Recreating components with every change check, Angular 2's *ngFor feature constantly updates

Within my code, I am utilizing two nested *ngFor loops. The first loop iterates through libraries, while the second one iterates through all items within each library, where a specific Angular component is dedicated to each item. The issue arises when the ...

Is it possible to retrieve the HttpsError status from a Firebase function?

Within my firebase function, I deliberately throw an error with a specific status and message using the following code: throw new functions.https.HttpsError('permission-denied', 'Token does not match'); When I receive the server respo ...

How can you effectively monitor changes to data within a class in Angular 2?

Within my array, I am storing instances of the User class. This array is displayed using an *ngFor directive, rendering repeated <li> elements. When a user clicks on one of these items, the details for that user are shown in a detail control. The fi ...

Using varied colors to style list items

Is there a way to apply three different colors to my list items? What is the best method for achieving this? This is what I have in my code: li { width: 33.333%; float: left; padding: 15px; list-style: none; } .light { background-color: #0 ...

How to dynamically insert variables into a separate HTML file while creating a VS Code extension

Currently working on a vscode extension, I'm facing an issue with containing the html in a string (like this: https://github.com/microsoft/vscode-extension-samples/blob/main/webview-view-sample/src/extension.ts). It leads to a large file size and lack ...

What is causing the bootstrap nav-bar to not open on smaller screens?

This nav-bar functions properly on screens larger than 640px, but on smaller screens, the menu button does not display the menu items when clicked. You can view the site here. <nav class="navbar navbar-inverse"> <div class="container-fluid" ...

Is Angular2 the Perfect Fit for Custom HTML Webresources in Dynamics CRM 2016?

Has anyone experimented with integrating Angular2 for custom webresource development in Dynamics CRM 2016? I searched for resources but only came across tutorials on using AngularJS, such as this one ...

Arranging objects in an NSMutableArray in a specific order

Seeking assistance from knowledgeable individuals. I am currently working on populating a NSMutableArray with multiple objects and I require assistance in sorting the order based on the first element, which will invariably be a number. Any advice on how ...

Both an Angular and Java application seamlessly operating within a single domain

Recently Updated: Project 1: PHP, HTML, CSS, Java, mySQL Project 2: Angular, Spring Boot, PostgreSQL I am currently working on breaking off a part of Project 1 into a separate project (Project 2) that will operate independently with its own database. ...