8000 [WebProfilerBundle] Prevent toolbar links color override by css by alcalyn · Pull Request #27758 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[WebProfilerBundle] Prevent toolbar links color override by css #27758

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
Jul 5, 2018

Conversation

alcalyn
Copy link
Contributor
@alcalyn alcalyn commented Jun 28, 2018
Q A
Branch? 2.8
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets #27658
License MIT
Doc PR

Fixes this issue: #27658 (comment)

Links color in toolbar can be easily override by application css. As this could happens sometimes, this PR set links color with a stronger CSS precedence.

@@ -53,6 +53,9 @@
-webkit-font-smoothing: subpixel-antialiased;
-moz-osx-font-smoothing: auto;
}
div.sf-toolbar .sf-toolbarreset a {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't you rather update the existing .sf-toolbar-block .sf-toolbar-info-piece a selector?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When doing so, it adds an underline on text icons:

screenshot-2018-6-29 welcome

I think this is not the "same" link I want to target

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These changes seems to look fine in 3.4:

diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar.css.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar.css.twig
index e3a0d8454f..5581e1303f 100644
--- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar.css.twig
+++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar.css.twig
@@ -160,11 +160,11 @@
     margin-bottom: 0;
 }
 
-.sf-toolbar-block .sf-toolbar-info-piece a {
+div.sf-toolbar .sf-toolbar-block .sf-toolbar-info-piece a {
     color: #99CDD8;
     text-decoration: underline;
 }
-.sf-toolbar-block .sf-toolbar-info-piece a:hover {
+div.sf-toolbar .sf-toolbar-block .sf-toolbar-info-piece a:hover {
     text-decoration: none;
 }

This rule:

.sf-toolbar-block > a,
.sf-toolbar-block > a:hover {
display: block;
text-decoration: none;
}
ensures direct .sf-toolbar-block > a (i.e the toolbar item itself, containing the icon) does not get an underline. Perhaps need to be enforced as well with div.sf-toolbar to strengthen precedence over your own css.

We must also double-check other css rules using text-decoration: none to ensure they keep precedence over the changed selectors.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok I get your point, thank you.

It works on 2.8

@alcalyn alcalyn force-pushed the prevent-override-toolbar-link-color branch from 94b0a3f to b3dadf6 Compare July 2, 2018 08:53
@alcalyn alcalyn force-pushed the prevent-override-toolbar-link-color branch from b3dadf6 to e12e217 Compare July 2, 2018 09:10
@alcalyn alcalyn changed the title Prevent toolbar links color override by css [WebProfilerBundle] Prevent toolbar links color override by css Jul 3, 2018
@fabpot
Copy link
Member
fabpot commented Jul 5, 2018

Thank you @alcalyn.

@fabpot fabpot merged commit e12e217 into symfony:2.8 Jul 5, 2018
fabpot added a commit that referenced this pull request Jul 5, 2018
…y css (alcalyn)

This PR was merged into the 2.8 branch.

Discussion
----------

[WebProfilerBundle] Prevent toolbar links color override by css

| Q             | A
| ------------- | ---
| Branch?       | 2.8
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #27658
| License       | MIT
| Doc PR        |

Fixes this issue: #27658 (comment)

Links color in toolbar can be easily override by application css. As this could happens sometimes, this PR set links color with a stronger CSS precedence.

Commits
-------

e12e217  Prevent toolbar links color override by css
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
0