-
-
Notifications
You must be signed in to change notification settings - Fork 362
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
"view as" banner: add a tooltip so that users understand better what the screen does #1418
Conversation
@@ -18,6 +18,7 @@ import {waitGrainObs} from 'app/common/gutil'; | |||
import noop from 'lodash/noop'; | |||
|
|||
const t = makeT("ViewAsDropdown"); | |||
const userT = makeT('UserManagerModel'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I allowed myself to use translation strings that are "out" of the components (here in ACLUser and below in ViewAsBanner), as they fit the use-case. Is it okay?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a preview tag to the PR to have a way to easily check the result of this userT()
when app is in french.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"UnknownUser": "Utilisateur inconnu" | ||
"UnknownUser": "Utilisateur inconnu", | ||
"View as Yourself": "Voir en tant que vous-même", | ||
"You are viewing this document as": "Vous voyez ce document en tant que" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I directly updated the fr locale file instead of going through weblate. Is that okay?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO it is good as it does the same than the weblate result.
If I'm wrong please correct me dear gristlabs fellows.
Deployed commit |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello
and thank you for the job.
A little ask for a change :
- When over the tooltip, as it do not really change it's not very clear that it's a clickable element. (seems to imperceptibly change from really dark gray to black)
Elsewhere LGTM
Yeah I originally put a lighter gray color but ended up just following the mockup. What do you think Lucie? I can change to do something like this: hover.mp4 |
Stumbled upon a tiny color bug in dark theme on the eye icon on the left, allowed myself to add the small fix in this PR 👀 |
I had lucie's pseudo so she will have a notification |
Deployed commit |
e56acd5
to
32300a7
Compare
After talking with Lucie: I kept the blackish icon color, to have this interactive icon more pronounced than the non-interactive, gray eye on the left. Right now the green on yellow is not that great contrast-wise but this will change soon with the wcag-compliance changes planned after the themes rework. |
Deployed commit |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Thanks :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @manuhabitela ! Looks good overall, but I have a couple comments about colors.
app/client/ui/tooltips.ts
Outdated
@@ -596,6 +612,17 @@ const cssInfoTooltipButton = styled(cssInfoTooltipIcon, ` | |||
} | |||
`); | |||
|
|||
/* styling variant for tooltips displayed in info banners (where background is light yellow) */ | |||
export const cssInfoTooltipButtonInBannerInfo = styled(cssInfoTooltipIcon, ` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we actually want the style of the tooltip icon in the banner to be different from that elsewhere. I see that contrast is poor with the current style, but it's as poor in the banner as in the creator panel. It seems best to me to either stick to the same style as currently used elsewhere (and worry about contrast later), or to update that style to have more contrast everywhere now (perhaps the dark + green-on-hover that you have for the banner).
Wdyt?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added this because the banner, contrary to most other places like the creator panel, doesn't change colors when in dark mode. Without this specific style, it then looks like this:
tooltip-colors.mp4
And if I applied this new style everywhere, tooltips would now be barely visible in most places in dark theme.
Instead of creating this tooltip variant, I could just update the Banner css, like for the --icon-color
stuff above. But I felt it started to be weird having a few tooltip-related styles in a totally different part of the code, instead of being explicit and creating an actual tooltip style variant.
Or maybe I could rename this style variant to be more generic and not namely tied to the banner, like 'always-dark'?
Now it looks like this:
newtooltip.mp4
Maybe I'm missing something and this could be done in another way?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand the issue now, thanks for explaining. Yes, there is a simpler way, to avoid passing a new argument through so much of the code. Since there is already an argument to customize style of the tooltip button using iconDomArgs
(which I see you using in this revision), you can add style variants like so:
In ViewAsBanner.ts
:
import { cssInfoTooltipButton, withInfoTooltip } from 'app/client/ui/tooltips';
withInfoTooltip(
cssPrimaryButtonLink(...),
'viewAsBanner',
{
iconDomArgs: [
cssInfoTooltipButton.cls('-in-banner'), // <-- this is what adds a css class variant to the button
testId('view-as-help-tooltip'),
],
...)
In tooltips.ts
:
export const cssInfoTooltipButton = styled(cssInfoTooltipIcon, `
cursor: pointer;
&:hover {
border: 1px solid ${theme.controlSecondaryHoverFg};
color: ${theme.controlSecondaryHoverFg};
}
&-in-banner {
color: ${colors.dark};
border-color: ${colors.dark};
}
&-in-banner:hover {
border-color: ${colors.lightGreen};
color: ${colors.lightGreen};
}
`);
The &-in-banner
blocks define this variant. It's simply another CSS class applied to the tooltip-button element.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, why not :)
Feels like the solution with more code allowed for more isolated code, like you don't have to know about the internals, the specific classes to apply; you just know you can apply a different look. But for sure this solution is more straightforward for this pretty specific case.
32300a7
to
09340b6
Compare
I added a very small test, just making sure the new help tooltip is there in the DOM. Figured I wouldn't test the actual tooltip behavior here. Should I make my test more specific? Ie making sure it's clickable, have correct help text…? Some tests don't pass (Importer), pretty sure they are completely unrelated to this PR code? |
Deployed commit |
09340b6
to
0748453
Compare
Deployed commit |
app/client/components/Banner.ts
Outdated
@@ -122,6 +122,7 @@ const cssBanner = styled('div', ` | |||
|
|||
&-info { | |||
color: black; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest changing this to ${colors.dark}
along the way, for consistency.
app/client/ui/tooltips.ts
Outdated
@@ -596,6 +612,17 @@ const cssInfoTooltipButton = styled(cssInfoTooltipIcon, ` | |||
} | |||
`); | |||
|
|||
/* styling variant for tooltips displayed in info banners (where background is light yellow) */ | |||
export const cssInfoTooltipButtonInBannerInfo = styled(cssInfoTooltipIcon, ` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand the issue now, thanks for explaining. Yes, there is a simpler way, to avoid passing a new argument through so much of the code. Since there is already an argument to customize style of the tooltip button using iconDomArgs
(which I see you using in this revision), you can add style variants like so:
In ViewAsBanner.ts
:
import { cssInfoTooltipButton, withInfoTooltip } from 'app/client/ui/tooltips';
withInfoTooltip(
cssPrimaryButtonLink(...),
'viewAsBanner',
{
iconDomArgs: [
cssInfoTooltipButton.cls('-in-banner'), // <-- this is what adds a css class variant to the button
testId('view-as-help-tooltip'),
],
...)
In tooltips.ts
:
export const cssInfoTooltipButton = styled(cssInfoTooltipIcon, `
cursor: pointer;
&:hover {
border: 1px solid ${theme.controlSecondaryHoverFg};
color: ${theme.controlSecondaryHoverFg};
}
&-in-banner {
color: ${colors.dark};
border-color: ${colors.dark};
}
&-in-banner:hover {
border-color: ${colors.lightGreen};
color: ${colors.lightGreen};
}
`);
The &-in-banner
blocks define this variant. It's simply another CSS class applied to the tooltip-button element.
test/nbrowser/AccessRules2.ts
Outdated
@@ -109,6 +109,7 @@ describe("AccessRules2", function() { | |||
assert.equal(await driver.findWait('.test-view-as-banner', 2000).isPresent(), true); | |||
assert.match(await driver.find('.test-view-as-banner .test-select-open').getText(), | |||
new RegExp(gu.translateUser('user3').name, 'i')); | |||
assert.equal(await driver.find('.test-info-tooltip.test-view-as-help-tooltip').isPresent(), true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can change isPresent
to isDisplayed
to make this check a tiny bit stricter: isPresent
only checks if an element is present in the DOM, while isDisplayed
checks that it's visible (e.g. doesn't have display: none
style).
0748453
to
ff18f89
Compare
Thanks @dsagal, updated with your feedback (will just need a rebase to merge the fixup commit correctly). |
Deployed commit |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thank you @manuhabitela !
in the "view as" banner, the role strings (owner, editor, viewer) were not translated and we can re-use the ones defined in the UserManagerModel (i guess?).
eye icon was light grey on yellow in dark theme, making it basically invisible, forcing dark color all the time
ff18f89
to
cbd2813
Compare
Thanks, I rebased and cleaned the commits 👌 |
Deployed commit |
Context
Fixes #1328.
Proposed solution
Has this been tested?
Added a very small test, just making sure the new tooltip icon is there. Should I be more specific?
Screenshots / Screencasts