What causes flex boxes to break when unique non-standard elements are added into the DOM?

I observed this issue specifically with Angular JS directive-elements, but here is a concise reproduction code:

Working code (the parent div width is set to 30rem) :

div {
  display: flex;
  padding-top: .5rem;
}
.parent {
  flex: 0 0 30rem;
  background-color: BlueViolet;
}
.child {
  flex: 0 0 15rem;
  background-color: DeepSkyBlue;
}
.text {
  background-color: DarkOrange;
}
<div>
  <div class="parent">
    <div class="child">
      <span class="text">Dummy text</span>
    </div>
  </div>
</div>

Non-working code (the parent div width does not remain at 30rem : it appears differently in Chrome & Firefox, and scales down to 15rem in IE11):

div {
  display: flex;
  padding-top: .5rem;
}
.parent {
  flex: 0 0 30rem;
  background-color: BlueViolet;
}
.child {
  flex: 0 0 15rem;
  background-color: DeepSkyBlue;
}
.text {
  background-color: DarkOrange;
}
<div>
  <dummy-tag>
    <div class="parent">
      <div class="child">
        <span class="text">Dummy text</span>
      </div>
    </div>
  </dummy-tag>
</div>

Could this potentially be a new bug related to flexbox ?

Answer №1

The behavior of flex is not limited to non-standard elements, but rather any element that does not have the correct display property set. By default, these elements are treated as inline elements.

Replacing a <dummy-tag> with a <div> will produce a comparable result.

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

You cannot modify a variable inside an event handler function unless it is declared globally in the code

I am facing an issue with my nodejs backend app that uses mongoose for database connections and queries within an event handler of socket.io. Specifically, the problem arises when I try to update a variable within a callback function of a mongoose query in ...

Chrome not displaying Skeletal Animation in Three.js GLB files

I am attempting to implement basic embedded skeletal animation in a .glb model using Three.js The workaround I found is from a discussion on this forum: I have written the simplest code possible. The animation is being located (can be logged into the con ...

What could be causing the form body to return null in a PUT request?

What could be causing the form data to not be stored in req.body? EJS/HTML <form onsubmit="EditJob()" class="editForm"> <div class="form-group-edit"> <label for="position">Position</label> <input type="pos ...

Preventing circular dependencies in AngularJS through efficient use of the Mediator pattern

I am working with two services and a mediator in my project. I have encountered an issue where the mediator needs to call and be called by both services, leading me to believe that they need to depend on each other. However, this is resulting in a circular ...

Unlocking the Power of mapState in JavaScript Files

How can I access my states from a `.js` file using `mapState` in Vue.js? I attempted to do so with the following code: import { mapState } from 'vuex'; const foo = { ...mapState(['axios']), }; foo.axios.get('...'); Unfo ...

Angular Elements - Additional Attribute Bindings

My goal is to create a series of versatile components (angular 1.5) with various optional bindings that can be utilized in multiple applications. I am concerned about the potential creation of unnecessary watchers for an application that does not utilize ...

Utilizing JavaScript functions within a Twig loop

I need help with a code that displays the phone number of various posters. {% for ad in ads %} ... <a class="btn" onclick="showNumber()" id="showNumber"><span class="fa fa-phone"></span> View Phone Number</a> <input id ...

Choose an option within a row of a table

Is there a way to display the div element with the .mynote class when clicking on the input that has an id of title? I attempted the code below, however, it does not seem to be functioning as expected. $("#title").click(function() { $(".mynote").show( ...

Dealing with JWT management in the absence of Cookies

After doing some research on JSON Web Token (which is a new concept to me), I have learned about its secure mechanism for transmitting information between parties without the need for server Sessions. Currently, I am in the process of building a web app f ...

If the radio button is selected, proceed to the specified link

I am working on a quote website and I would like the user to be able to view the most recent quotes by clicking on a radio button. However, I am unsure how to make the radio button redirect to a specific page. <input type="radio" name="order" id="noi" ...

JQuery email validation failing to function

I am new to JQuery and have created a basic validation script to verify email addresses. However, it does not seem to be working properly. Can anyone provide guidance on how to correct this issue? <script> $( "#email" ).blur(function() { var ...

Utilizing a function as a value in React state (setState) compared to defining state with constructor in a class and utilizing a state object

Can someone help me understand the concept of state in React better? I'm confused about the differences between these two implementations: This: class Todo extends ... { constructor (){ super() this.state = { ... } } } And This: class Todo extend ...

Adjust the size of the browser window using JS/Jquery when accessing a website

I created my first website a few months ago, but unfortunately it is not responsive. The website was designed for 1280x1024px screens, so it does not adjust properly on larger or smaller screens. While I am not concerned about the display on smaller screen ...

How can I avoid using "data.*" in the Angular Material dialog template?

I have a template similar to the one provided below: card.component.html <mat-card class="mat-elevation-z4"> <img mat-card-image src="{{ item.media_url }}" /> <mat-card-content class="custom"> <p& ...

Error: Unable to iterate over JSON data as json.forEach is not a valid function

let schoolData = { "name": "naam", "schools" : [ "silver stone" , "woodlands stone" , "patthar" ], "class" : 12 } schoolJSON = JSON.stringify(sc ...

Warning: MaxListenersExceededNotification may occur during the installation or creation of Node.js projects on macOS

Encountering a warning message while attempting to set up or generate Node.js projects on macOS (darwin): (node:80101) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 close listeners added to [TLSSocket]. Use emitter.setMaxList ...

Find the Nearest Value with Jquery and Swap Out the Div

When users complete a form and click "continue," they move on to the next section. At the top of the page, a heading indicates that the previous form is finished. If users click on the heading, it expands the completed form so they can edit it. For instan ...

Wrapping dynamic page titles with comment tags in NextJS for cleaner code

I am currently working on NextJS version 12. In my project, I have a file named Layout.js which contains the following code: import Head from "next/head"; const Layout = ({children, pageTitle, mainClass}) => { return ( <> ...

Creating new routes on-the-fly in AngularJS

While working with the $routeProvider in the config method, it came to my attention that $route functions as a provider. Curious about adding new routes to $route from within my controller: Following the configuration and bootstrap of the application, I ...

Insert a fresh item into the existing unordered list

Every time I enter something in the prompt, it shows up as "undefined". What I actually want is for whatever I type into the prompt to be added as a new list item. For instance, if I type "Food" in the prompt, I expect to see "Food" appear on the second li ...