Page MenuHomePhabricator

Explore ways to avoid adding the extra border size to components' heights & widths
Closed, ResolvedPublic

Description

This is actually about changing the current approach of defining the height of elements based on: text line-height + vertical padding +border. A decision that should be revisited. See Codepen with new approach (getting rid of vertical paddings and defining the height of components separately).

  • Elements should always keep their given system heights (32px (2em), 40px (3em))
  • Paddings should have system dimensions

Note:

Working with borders (e.g. in buttons) means always having to deal with an extra 1px, which can be alleviated by:

  1. having to apply weird 11px, 15px paddings to create the desired space; OR
  1. applying the right padding value but creating weird spacing like 13px (1px+12px padding)

Both solutions are suboptimal. This could be solved by using insets instead of borders: we could keep using system-compliant paddings and end up with the right spacing and sizing as a result.

Deciding factors:

  • Figuring out if insets can take all the properties that can be assigned to borders
  • Browser compatibility

Related Objects

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript
Sarai-WMDE renamed this task from Explore the benefits of using box-shadow inset instead of border to Explore the benefits/trade-offs of using box-shadow inset instead of border.Oct 2 2020, 8:23 AM
Sarai-WMDE updated the task description. (Show Details)
Sarai-WMDE renamed this task from Explore the benefits/trade-offs of using box-shadow inset instead of border to Explore ways to avoid adding the border size to component sizes.Oct 2 2020, 10:21 AM
Sarai-WMDE updated the task description. (Show Details)
Sarai-WMDE renamed this task from Explore ways to avoid adding the border size to component sizes to Explore ways to avoid adding the extra border size to component sizes.Oct 2 2020, 10:31 AM
Sarai-WMDE renamed this task from Explore ways to avoid adding the extra border size to component sizes to Explore ways to avoid adding the extra border size to component sizes (height).Oct 2 2020, 11:37 AM
Sarai-WMDE renamed this task from Explore ways to avoid adding the extra border size to component sizes (height) to Explore ways to avoid adding the extra border size to component height.Oct 2 2020, 11:44 AM
Sarai-WMDE updated the task description. (Show Details)
Sarai-WMDE renamed this task from Explore ways to avoid adding the extra border size to component height to Explore ways to avoid adding the extra border size to components' heights & widths.Oct 21 2020, 1:28 PM

From my experience, there is no convincing solution that would result in even numbers (I read this as such expectation).
Setting line-height to something different than 20 results in issues with multiline elements or certain scripts.

These numbers are also essentially to be ignored once they're set as variable values.