Fix vertical alignment of GitLab SVG icons
What does this MR do?
Epic: &2331 (closed)
Problem
Using GitLab SVGs inside the GitLab code-base currently doesn't Just Work. Specifically:
- When inserting an icon, we need to add utility classes (like
gl-vertical-align-text-bottom
) or use flexbox on the icon container. - When using the
sprite_icon
helper, we need to specify the size of the icon even though our most common use case is 16px. Without the size, the HTML renders a giant icon which breaks layout.
This MR tries to fix these issues so we can simplify code from this:
= sprite_icon('comments', size: 16, css_class: 'gl-vertical-align-text-bottom')
to this:
= sprite_icon('comments')
The vertical alignment also applies to icons adding using GlIcon
from GitLab UI.
If and when this MR is merged, I will follow-up with another MR to update all current instances to a. Remove size
from sprite_icon
when it's set to 16 and b. Remove any redundant classes used to vertically re-align icons.
Screenshots
Project overview
Project overview before / after
Before | After |
---|---|
MR listing
Does this MR meet the acceptance criteria?
Conformity
-
Changelog entry -
Documentation (if required) -
Code review guidelines -
Merge request performance guidelines -
Style guides -
Database guides -
Separation of EE specific content
Availability and Testing
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process. -
Tested in all supported browsers -
Informed Infrastructure department of a default or new setting change, if applicable per definition of done
Security
If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:
-
Label as security and @ mention @gitlab-com/gl-security/appsec
-
The MR includes necessary changes to maintain consistency between UI, API, email, or other methods -
Security reports checked/validated by a reviewer from the AppSec team
Edited by Justin Ho Tuan Duong