Skip to content

Commit

Permalink
Add better positioning for tooltips on edges (#13472)
Browse files Browse the repository at this point in the history
  • Loading branch information
tassoevan authored and rodrigok committed Mar 2, 2019
1 parent 84633d2 commit 0105b8d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
6 changes: 3 additions & 3 deletions packages/rocketchat-ui-flextab/client/flexTabBar.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ <h1 class="contextual-bar__header-title">{{_ label}}</h1>
<div class="rc-room-actions iframe-toolbar">
{{#each .}}
<div class="rc-room-actions__action tab-button {{active}} {{visible}} {{class}} js-iframe-action" data-id="{{id}}">
<button class="rc-tooltip rc-tooltip--down rc-room-actions__button" aria-label="{{title}}">
<button class="rc-tooltip rc-tooltip--down rc-tooltip--end rc-room-actions__button" aria-label="{{title}}">
{{> icon block="tab-button-icon" icon=icon }}
</button>
</div>
Expand All @@ -45,14 +45,14 @@ <h1 class="contextual-bar__header-title">{{_ label}}</h1>
<div class="rc-room-actions">
{{#each buttons}}
<div class="rc-room-actions__action tab-button {{active}} {{visible}} {{class}} js-action" data-id="{{id}}">
<button class="rc-tooltip rc-tooltip--down rc-room-actions__button" aria-label="{{title}}">
<button class="rc-tooltip rc-tooltip--down rc-tooltip--end rc-room-actions__button" aria-label="{{title}}">
{{> icon block="tab-button-icon" icon=icon }}
</button>
</div>
{{/each}}
{{# with moreButtons}}
<div class="rc-room-actions__action {{opened}}">
<button class="rc-tooltip rc-tooltip--down rc-room-actions__button js-more" aria-label="{{_ 'More'}}">
<button class="rc-tooltip rc-tooltip--down rc-tooltip--end rc-room-actions__button js-more" aria-label="{{_ 'More'}}">
{{> icon block="tab-button-icon" icon="menu" }}
</button>
</div>
Expand Down
15 changes: 13 additions & 2 deletions packages/rocketchat_theme/client/imports/components/tooltip.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.rc-tooltip {
position: relative;
--translation-x: -50%;

&::before,
&::after {
Expand All @@ -9,7 +10,7 @@
left: 50%;

transition: all 0.18s ease-out 0.18s;
transform: translate(-50%, 10px);
transform: translate(var(--translation-x), 10px);
transform-origin: top;
pointer-events: none;

Expand Down Expand Up @@ -61,6 +62,16 @@
border-color: transparent transparent var(--tooltip-background) transparent;
}
}

&--start,
.rtl &--end {
--translation-x: -10%;
}

&--end,
.rtl &--start {
--translation-x: -90%;
}
}

@media (min-width: 501px) {
Expand All @@ -69,7 +80,7 @@
&:hover::after,
&:focus::before,
&:focus::after {
transform: translate(-50%, 0);
transform: translate(var(--translation-x), 0);
pointer-events: auto;

opacity: 1;
Expand Down

0 comments on commit 0105b8d

Please sign in to comment.