Skip to content

[VarDumper] Fix CSS alignment in HtmlDumper #53147

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

Merged
merged 1 commit into from
Dec 28, 2023

Conversation

alexandre-daubois
Copy link
Member

Q A
Branch? 6.3
Bug fix? yes
New feature? no
Deprecations? no
Issues Fix #53103
License MIT

Bottom alignment seems the right one here:

image

@Nyholm
Copy link
Member

Nyholm commented Dec 19, 2023

Thank you.

CSS is tricky and I am no expert. But why does bottom work and not top? How come middle doesn't do the trick?

What I really wonder is: Is this according to the official rules and have this been tested in more than one browser?

@stof
Copy link
Member

stof commented Dec 19, 2023

Intuitively, I would say that we want to align the baseline of the text here, so using baseline

@alexandre-daubois
Copy link
Member Author

It depends on the "bounding box" of the element. The FQCN is actually two parts here: the grey and the green one.

The green part of the FQCN is already centered in its section. If the bounding-box is a bit taller than the text, then the "vertical-align: top" of the grey part pushes it on top of the bounding box. Not sure I'm super clear here 😅

@stof I'm having a look at this solution

@alexandre-daubois
Copy link
Member Author

Unfortunately, baseline doesn't work well:

image

@javiereguiluz
Copy link
Member

I've played a bit with this and to me, this was solved by doing this change instead:

 pre.sf-dump span {
-    display: inline;
+    display: inline-flex;
 }

Can you please try if this also solves the design issues for you? Thanks!

@alexandre-daubois alexandre-daubois force-pushed the fix-webprofiler-alignment branch from f8a2aa7 to 3a71a06 Compare December 28, 2023 15:37
@alexandre-daubois
Copy link
Member Author

I can confirm this works well. Thanks Javier, PR updated!

@Nyholm
Copy link
Member

Nyholm commented Dec 28, 2023

Thank you @alexandre-daubois.

@Nyholm Nyholm merged commit b98a25a into symfony:6.3 Dec 28, 2023
nicolas-grekas added a commit that referenced this pull request Jan 9, 2025
This PR was merged into the 6.4 branch.

Discussion
----------

[VarDumper] Fix blank strings display

| Q             | A
| ------------- | ---
| Branch?       | 6.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Issues        | Fix #57980
| License       | MIT

Because `sf-dump-ellipsis` `span`s needed a `text-ellipsis`, their overflowing content was cut using `overflow: hidden`. As it required their inner display type to be `block`, this broke the alignment with the ellipsis’ “tail”. This was fixed by #53147 by making every dump’s `span`s `inline-flex`.

This change made `sf-dump-ellipsis`’ `display`, `max-width` and `vertical-align` properties useless so this PR removes them, as well as a duplicated `overflow` one.

Now, `inline-flex` elements’ content becomes flex items, which caused #57980 because

> if the entire sequence of [a flex item’s] text runs contains only white space […] it is […] not rendered
>
> https://www.w3.org/TR/css-flexbox-1/#flex-items

Instead of making every dump’s `span`s `inline-flex`, this PR targets a new `sf-dump-ellipsization` class added to `sf-dump-ellipsis`’ parents.

It also wraps ellipsis tails with elements bearing the `sf-dump-ellipsis-tail` class so that we can prevent them to shrink:

**Before**:

![](https://github.com/user-attachments/assets/8dfb21ac-ce39-4202-a5aa-af93bac5c7f5)

**After**:

![](https://github.com/user-attachments/assets/15e8b344-5d12-4c89-8b29-3ef0a3928495)

Commits
-------

b0c2a59 [VarDumper] Fix blank strings display
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants