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.

lightbox: Prevent long titles from altering layout.

Austin Ribaeae0975b63d4
diff --git a/static/js/lightbox.js b/static/js/lightbox.js
index 3f0d441c8e6..da79e74ed81 100644
--- a/static/js/lightbox.js
+++ b/static/js/lightbox.js
@@ -217,8 +217,10 @@ function display_image(payload) {
img.src = payload.source;
img_container.html(img).show();
- $(".image-description .title").text(payload.title || "N/A");
- $(".image-description .user").text(payload.user);
+ $(".image-description .title")
+ .text(payload.title || "N/A")
+ .prop("title", payload.title || "N/A");
+ $(".image-description .user").text(payload.user).prop("title", payload.user);
$(".image-actions .open, .image-actions .download").attr("href", payload.source);
}
diff --git a/static/styles/lightbox.css b/static/styles/lightbox.css
index 1b8c4641f0d..26b34d60910 100644
--- a/static/styles/lightbox.css
+++ b/static/styles/lightbox.css
@@ -48,11 +48,11 @@
}
.exit {
- float: right;
+ flex-shrink: 0;
color: hsla(0, 0%, 100%, 0.8);
font-size: 2rem;
- margin: 11px 20px 0 0;
+ margin: 6px 20px 0 0;
transform: scaleY(0.75);
font-weight: 300;
@@ -70,16 +70,18 @@
.image-info-wrapper {
background-color: transparent;
+ display: flex;
+ flex-flow: row wrap;
}
.image-description,
.image-actions {
- float: left;
margin: 20px;
}
.image-actions {
- float: right;
+ flex-shrink: 0;
+ margin-left: auto;
.lightbox-canvas-trigger {
display: inline-block;
@@ -150,21 +152,21 @@
}
.image-description {
+ display: flex;
+ flex-direction: column;
+ max-width: calc(100% - 350px);
/* add some extra margin top and remove some bottom to keep the
height the same. and vertically center the text with the buttons. */
margin-top: 25px;
margin-bottom: 15px;
- font-size: 1.3rem;
+ font-size: 1.1rem;
color: hsl(0, 0%, 100%);
.title {
- display: inline-block;
vertical-align: top;
-
font-weight: 400;
line-height: normal;
- max-width: calc(100% - 110px);
/* Required for text-overflow */
white-space: nowrap;
@@ -174,8 +176,6 @@
.user {
max-width: 200px;
- display: inline-block;
- vertical-align: top;
font-weight: 300;
line-height: normal;
text-overflow: ellipsis;
@@ -262,7 +262,8 @@
@media only screen and ($ms_min <= width < $md_min) {
#lightbox_overlay {
.image-actions {
- float: left;
+ width: 100%;
+ padding-left: 15px;
margin-top: 0;
}
@@ -272,10 +273,6 @@
overflow: hidden;
text-overflow: ellipsis;
margin-bottom: 5px;
-
- .title {
- max-width: calc(100% - 70px);
- }
}
.center .image-list {
@@ -290,7 +287,17 @@
}
.image-preview {
- height: calc(100% - 101px - 95px);
+ height: calc(100% - 101px - 104px);
+ }
+
+ .image-info-wrapper {
+ align-items: flex-end;
+ }
+
+ .exit {
+ position: absolute;
+ right: 5px;
+ top: 6px;
}
}
}
diff --git a/static/templates/lightbox_overlay.hbs b/static/templates/lightbox_overlay.hbs
index 20fde407d3f..6ad6537fd6f 100644
--- a/static/templates/lightbox_overlay.hbs
+++ b/static/templates/lightbox_overlay.hbs
@@ -4,7 +4,6 @@
<div class="title"></div>
<div class="user"></div>
</div>
- <div class="exit" aria-label="{{t 'Close' }}"><span aria-hidden="true">x</span></div>
<div class="image-actions">
<div class="lightbox-canvas-trigger">
<div class="title">{{t "Pan & zoom" }}</div>
@@ -13,7 +12,7 @@
<a class="button small open" rel="noopener noreferrer" target="_blank">{{t "Open" }}</a>
<a class="button small download" download>{{t "Download" }}</a>
</div>
- <div class="clear-float"></div>
+ <div class="exit" aria-label="{{t 'Close' }}"><span aria-hidden="true">x</span></div>
</div>
<div class="image-preview no-select">