Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

pills: Make --height-input-pill authoritative.

Karl Stolleyf738a68bb1ef
diff --git a/web/styles/app_variables.css b/web/styles/app_variables.css
index 07cfabdf015..5a64b7d897d 100644
--- a/web/styles/app_variables.css
+++ b/web/styles/app_variables.css
@@ -420,9 +420,13 @@
--recent-topics-filters-height: 50px;
/* Pill dimensions. */
- /* 1.4286em is 20px at 14px/1em */
- --height-input-pill: 1.4286em;
- --length-input-pill-image: var(--height-input-pill);
+ /* 1.5714em is 22px (border-inclusive) at 14px/1em */
+ --height-input-pill: 1.5714em;
+ /* Reduce user pill image lengths by 2px to
+ preserve an apparent border around
+ them, and a square aspect-ratio, even under
+ `box-sizing: border-box` in the area. */
+ --length-input-pill-image: calc(var(--height-input-pill) - 2px);
--vertical-spacing-input-pill: 2px;
--outer-spacing-input-pill-container: var(--vertical-spacing-input-pill);
--horizontal-spacing-input-pill: 6px;
diff --git a/web/styles/input_pill.css b/web/styles/input_pill.css
index f4993efa3d0..2e454829445 100644
--- a/web/styles/input_pill.css
+++ b/web/styles/input_pill.css
@@ -18,6 +18,11 @@
min-width: 0;
height: var(--height-input-pill);
+ /* Make sure the `height` property
+ is the authoritative source of an
+ input pill's height, without being
+ affected by borders, etc. */
+ box-sizing: border-box;
margin: 0;
color: inherit;
@@ -35,7 +40,6 @@
.pill-image {
height: var(--length-input-pill-image);
width: var(--length-input-pill-image);
- min-width: var(--length-input-pill-image);
border-radius: 4px 0 0 4px;
}
diff --git a/web/styles/search.css b/web/styles/search.css
index 51f6b757c9f..6d16b53b3a7 100644
--- a/web/styles/search.css
+++ b/web/styles/search.css
@@ -175,13 +175,6 @@
.search-input {
/* Avoid massive inheritance chain on font-size. */
font-size: var(--base-font-size-px);
- /* override height-input-pill from default input pills to account for pill border */
- line-height: calc(
- var(--height-input-pill) + var(--vertical-spacing-input-pill)
- );
- min-height: calc(
- var(--height-input-pill) + var(--vertical-spacing-input-pill)
- );
/* override bootstrap padding for input[type="text"] */
padding: 0;
border: none;
@@ -252,7 +245,11 @@
}
.pill {
- height: var(--height-input-pill);
+ /* Reduce user pill height by 2px to
+ preserve an apparent border around
+ them even under `box-sizing: border-box`
+ in the area. */
+ height: calc(var(--height-input-pill) - 2px);
border: none;
border-radius: 3px;
max-width: none;
@@ -357,7 +354,7 @@
.pill-image {
/* Add line-height equal to height to mimic baseline alignment. */
- line-height: var(--length-input-pill-image);
+ line-height: var(--height-input-pill);
align-self: center;
}
}