Issues with Angular's :has selector functionality are causing it to perform inaccur

I've been attempting to make the has selector function properly with angular.

Here's my HTML code:

<ul class="check-list no-bullet-points mb-0">
      <ng-container *ngFor="let item of checkList.items">
        <li class="d-flex flex-row gap-3 align-items-center" [ngClass]="{ 'checklist-item-bigger': bigger }">
          <i class="item-icon fa-solid {{ item.icon }}"></i>
          <div class="item-text font-weight-bold">{{ item.text }}</div>
        </li>
      </ng-container>
    </ul>

I'm trying to show two rows if there are more than 5 list items present. I could apply a new class using [ngClass], but I believe it should be achievable with pure CSS. This is the selector I'm using:

.check-list:has(li:nth-child(5)) {
  display: flex;
  justify-content: start;
  align-items: center;
  flex-wrap: wrap;

  li {
    width: 50%;
    flex-shrink: 0;
  }
}

However, this doesn't seem to have any effect. Could ng-container be causing compatibility issues with this selector? I'm currently using Firefox, and as far as I know, Firefox fully supports the :has selector.

The CSS itself works fine when the selector is removed, so I must be making a mistake somewhere.

Answer №1

By default, Firefox does not support the :has pseudo-class.

Support for this feature is currently hidden behind the flag layout.css.has-selector.enabled starting from version 103.

To track the progress of implementing this feature, you can visit this link.

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

Exploring the functioning of Dependency Injection in components that are dynamically loaded

Given the setup of my components and services, with both Module A and B being lazy loaded, I have a scenario where the component container in Module A is dynamically loading Component B1. How does dependency injection work in this case? Does it look for de ...

Is there a way to adjust the transparency of a span element's background without affecting the text itself?

I have some code that needs to be customized. This is my HTML: <div class="text-rotator add-top-half add-bottom-half align-left white-txt medium-txt uppercase highlight-bg"> <div class="rotator-wrap" style="display: block;"> <sp ...

Customize Radio Button Color in Bootstrap 3 with JQuery

Here is the code for my radio buttons: <div class="form-group text-danger"> <label class="control-label col-md-4 pull-left text-danger" for="SongTitle">Is a Remix</label> <div class="col-md-8"> ...

Deactivate button using Javascript

Can anyone assist me with this issue I am having? I currently have a button set up as follows: <input type="button" id="myButton" name="myButton" value="ClickMe!!" onClick="callMe()"/> I need to disable the button using jQuery, standard javascript ...

The messages are not displayed by a reusable component that performs error validation for Reactive Forms

As I develop a web application using Angular 8, I am looking to create a reusable component that specifically displays error messages for my FormControls in order to avoid duplicating this logic throughout multiple sections of the application. I have imple ...

Submit data from one form to another form located within an iframe

I am currently using a JX Browser that allows content to be displayed in an iframe. My goal is to automatically transfer the username and password of a user logging into my ticketing software to another form within an iframe. The page within the iframe is ...

What is the best way to adjust the content of a Bootstrap Column to be at the bottom of the column

Currently diving into the world of Bootstrap for my personal website, I'm encountering a challenge in aligning the content of my sidebar to the bottom. My quest for a solution led me through numerous threads without success. <!-- wordsmith: < ...

The size of the search input and textarea in HTML decreases when viewed on an iPad device

Currently utilizing Bootstrap 3 and AngularJs for this project. Implementing the following markup for the input field with type 'search': <input type="search" class="form-control" id='roomSearch' placeholder="Search" ng-model=&apo ...

Even when assertExist is set to true in casperjs, the element cannot be located

I am currently encountering a problem with casperjs in my application. Here are the steps I am taking: 1) First, I am performing an assertion to check if the element exists. casper.then(function() { this.test.assertExists( { type: ' ...

What is the best way to navigate a link in Angular (15) that requires multiple parameters to be input?

I came across the following link: "https://api.api-soccer.com/v1/championship/10/stages/168" My goal is to access the data within the ID /168, but I first need to access the ID at /10. Unfortunately, I'm unsure of how to achieve this using Angular. ...

Struggling to tally the entries and authenticate logins within Ionic 3 and Angular

In my application, users register by providing their email and password, which is then stored in a SQLite database. When the user attempts to log in using the same credentials, they should be redirected to the home page upon successful login. I am facing ...

Trigger an event when an Angular template's *ngIf condition is met

Let's say I am using the Angular directive *ngIf to display a user object like so: <div *ngIf="user$ | async as user" class="container"> <p>{{user.name}}</p> </div> Is there a method where I can trigger some code once this ...

Is it possible to utilize CSS to alter the header content when the window is minimized?

I am currently experimenting with replicating a website design from a popular clothing brand to enhance my knowledge of HTML and CSS. I am curious to know if it is possible to modify the header content when the window size is reduced, either through CSS al ...

Tips for saving the quantity of likes from an HTML "icon button"

I recently started exploring web development as a hobby and created a website. I have managed to implement all the features I wanted except for one. Despite researching extensively about databases and Ajax, I have not been able to find a solution that work ...

Troubleshooting why @HostListener seems to be malfunctioning

I implemented a drag event listener using the HostListener to determine if an element is being dragged inside or outside of the browser window. When the element is dragged inside the window, a "drop zone" div displays the message "Drop your files here". Ho ...

The issue of consistently receiving a null value when trying to choose a selection from a

The drop-down menu below failed to meet the required criteria in my validation and kept prompting me to select an option, even though one had already been chosen. <div class="col"> <label for="#">College Degree</label ...

"Internet Explorer text input detecting a keyboard event triggered by the user typing in a

It appears that the onkeyup event is not triggered in IE8/IE9 (uncertain about 10) when the enter button is pressed in an input box, if a button element is present on the page. <html> <head> <script> function onku(id, e) { var keyC = ...

Choosing an option from a drop-down menu with Selenium WebDriver

I've been troubleshooting this issue for over 2 months now. The problem arises when trying to select an item from a drop-down box using Selenium. Each time I run the script, it reports that it cannot locate the element. Can you identify what might be ...

Ways to add elements to an array nested within services and append to an object within another object

<pre lang="HTML"> <ul> <li data-ng-repeat="q in QuizObj"> <fieldset><legend>All Quizes </legend> <h1>{{q.Quiz }}</h1> <h3>options</h3> <h3>answer</h3> &l ...

Problem with displaying images and videos in a lightbox gallery

Currently, I am encountering an issue with the lightbox feature on my website. When trying to play a video, there seems to be a layer (div tag) blocking it, preventing me from playing or stopping the video. This problem occurs when clicking on an image fir ...