Skip to content

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

Project overview before / after

Before After
Project_before Project_after
Project_before_2 Project_after_2

MR listing

MR_listing

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

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

Merge request reports