Skip to content

Commit

Permalink
[FIX] Stop Firefox announcement overflowing viewport (#10503)
Browse files Browse the repository at this point in the history
* Stop Firefox announcement overflowing viewport

Fixes an issue where long announcement messages caused the right-hand
sidebar to and associated icons to be pushed outside the viewport due
to how non-wrapping whitespace was interacting with flex layout.

As a tradeoff, this commit causes overflowing text to no longer be
displayed with a nice ellipsis in other browsers, simply cutting it
short instead.

* Restore announcement ellipsis overflow

Announcment text is now wrapped in a `<p>` element which allows an
extra flex container to control text overflow for long announcements.
With this addition, announcements no longer make the right sidebar and
its associated icons innaccessible by pushing them out of the viewport.

A previous commit accomplished this by allowing whitespace to wrap,
which caused overflowing text to clip rather than receive an ellipsis.
This commit restores the ellipsis.
  • Loading branch information
brendangadd authored and rodrigok committed Apr 25, 2018
1 parent 159ad34 commit 26acb0e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
13 changes: 10 additions & 3 deletions packages/rocketchat-theme/client/imports/general/base_old.css
Original file line number Diff line number Diff line change
Expand Up @@ -1691,16 +1691,15 @@
}

.rc-old .announcement {
display: block;
display: flex;
flex-flow: row nowrap;
overflow: hidden;

height: 40px;
padding: 0 20px;

cursor: pointer;
text-align: center;
white-space: nowrap;
text-overflow: ellipsis;

color: var(--rc-color-content);

Expand All @@ -1716,6 +1715,14 @@

color: currentColor;
}

p {
width: 0; /* Grow via flex. */
flex: auto;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
}

.rc-old .cms-page {
Expand Down
2 changes: 1 addition & 1 deletion packages/rocketchat-ui/client/views/app/room.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
{{#unless embeddedVersion}}
{{#if showAnnouncement}}
<div class="fixed-title announcement {{getAnnouncementStyle}}" aria-label="{{RocketChatMarkdown roomAnnouncement}}">
{{{RocketChatMarkdown roomAnnouncement}}}
<p>{{{RocketChatMarkdown roomAnnouncement}}}</p>
</div>
{{/if}}
{{/unless}}
Expand Down

0 comments on commit 26acb0e

Please sign in to comment.