Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some elements don't increase stack height #11

Open
OrionReed opened this issue Mar 29, 2024 · 3 comments
Open

Some elements don't increase stack height #11

OrionReed opened this issue Mar 29, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@OrionReed
Copy link
Owner

Elements like <a> and <i> tags don't appear to have any effect on stack height. This is troublesome because there could be others too. Understanding why this is happening would improve confidence in the rest of the DOM view being accurate.

Note how the tags inside the paragraph here are styled lighter (indicating deeper nesting in the DOM) but do not increase depth.
Screenshot 2024-03-28 at 22 54 12

@OrionReed OrionReed added the bug Something isn't working label Mar 29, 2024
@nozsavsev
Copy link

nozsavsev commented Mar 30, 2024

I experimented a bit and it turns out that any element with 'display: inline' is causing this issue.
Usually, inline elements are 'span' 'i' 'strong' 'a' so they are problematic by default, but you can fix it without breaking most of the things by just applying 'inline-block'.
As you can see in the image any elements which are children of display inline will lay flat.

I am still trying to understand how the script works so I won't write a fix at least for now.

Screenshot 2024-03-30 145528
Screenshot 2024-03-30 145548

@OrionReed
Copy link
Owner Author

This is great, lead me to some of the transforms spec which notes:

A transformable element is an element in one of these categories:

Which means the ultimate question becomes:

  • Can we robustly change these elements such that they can be transformed without affecting the layout/styling as viewed from the Z direction (as in, the normal view)

But short term, I'm wondering what mitigation strategies there are, doing something like display: displayCurrent === "inline" ? "inline-block" : displayCurrent might make some headway, but this requires a call to window.getComputedStyle(node) which is incredibly expensive to do for every node.

@nozsavsev
Copy link

nozsavsev commented Apr 1, 2024

According to this list of elements that are inline by default
https://www.w3schools.com/html/html_blocks.asp

you can use this style

a, abbr, acronym, b, bdo, big, br, button, cite, code, dfn, em, i, img, input, kbd, label, map, object, output, q, samp, script, select, small, span, strong, sub, sup, textarea, time, tt, var,  {
    display: inline-block important;
}

I think that if person specifically set something to be inline it should be kept inline, but for elements inline by default this should work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants