Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add better positioning for tooltips on edges #13472

Merged
merged 1 commit into from
Mar 2, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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