-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Menu item hover / active states (including with pt-intent-*) #565
Conversation
&#{$disabled-selector} { | ||
color: $pt-dark-text-color-disabled; | ||
} | ||
} | ||
|
||
@mixin menu-item-intents($text-color: $pt-intent-text-colors) { |
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.
Still don't feel great about @pkwi any thoughts on text and background colors? |
I think for intents, coloured text with the coloured background on hover makes perfect sense. You want to differentiate these actions with a different colour (for example, red text for "Delete" option). However, you don't want them to be visually dominant, hence the coloured background change happens on only on hover. |
@llorca @giladgray @cmslewis we seem pretty solid on this setup, good to review! |
Agreed with @pkwi on the |
&::before, | ||
&::after, | ||
.pt-menu-item-label { | ||
color: $color; |
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.
For that loop, can we do it the callout way? https://github.com/palantir/blueprint/blob/master/packages/core/src/components/callout/_callout.scss#L80
The icon should be of the 3rd shade ($pt-intent-colors
), while the text is always a shade lighter or darker ($pt-[dark-]intent-text-colors
)
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.
Changed the icon colors.
I don't wanna do it exactly the same because the usage requires a delicate mix of .pt-disabled
in the _menu.scss
file and I want to keep that logic there. The map-get
in callout just does the same thing as using $color
. We do use both in places - I think you're collating them already in another branch?
} | ||
|
||
&:active, | ||
&.pt-active { |
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.
.pt-active
is very dark... I'd like to propose a small design change where:
.pt-active
isnth(map-get($button-intents, $intent), 1)
&:hover:active, .pt-active:active
isnth(map-get($button-intents, $intent), 2)
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.
Yeah this is tough...
Having different colors messes with our model of .pt-active
=== :active
elsewhere but for the anticipated usage here, what you propose definitely looks better.
color: inherit; | ||
|
||
&:not(#{$disabled-selector})#{$hover-selector} { |
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.
can we plesae avoid this scary specific selector by redefining background
in the disabled selector?
happens a few times throughout this change.
&.pt-active { | ||
color: $white; | ||
|
||
&::before, |
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.
add &,
to this selector list and remove line 87 above.
@@ -195,6 +197,9 @@ Markup: | |||
Styleguide components.menu.css | |||
*/ | |||
|
|||
$menu-item-color-active: $minimal-button-background-color-active !default; | |||
$dark-menu-item-color-active: $dark-minimal-button-background-color-active !default; |
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.
why are these defined here but $menu-item-color-hover
is defined in _common.scss? i think all vars should be in _common.
@@ -342,6 +346,15 @@ Styleguide components.menu.css.header | |||
} | |||
} | |||
|
|||
&:not(.pt-disabled) { |
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.
🔥 look, how hard is it to not have to use :not()
here and just override properties when disabled?
this is hard to grok because these are actually the default un-interacted styles (i think?) but the nesting makes me think they're for a modifier, when it's actually the inverse.
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.
fair, we'll need to reset all the icons and text too, but i guess that's only 1 more level down anyway - updated
const itemClasses = classNames(Classes.MENU_ITEM, { [Classes.ACTIVE]: props.isActive }); | ||
const itemClasses = classNames(Classes.MENU_ITEM, { | ||
[Classes.ACTIVE]: props.isActive, | ||
[Classes.intentClass(Intent.PRIMARY)]: props.isActive, |
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.
[Classes.INTENT_PRIMARY]
since you know. same below.
} | ||
|
||
.pt-menu-item.pt-active, | ||
.pt-menu-item:hover { | ||
.pt-menu-item.pt-active { | ||
.docs-result-path { |
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.
merge this with line above so it's clearly one selector. .pt-menu-item.pt-active .docs-result-path
} | ||
|
||
.pt-menu-item-label { | ||
color: $text-color-disabled; |
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.
this actually seems like an appropriate use for !important
: disabled beats everything else, so it can force its styles to override more specific selectors. should allow you to revert most of this 👍
} | ||
|
||
&.pt-disabled { | ||
// override global a:focus styles | ||
outline: none; | ||
background-color: inherit; | ||
cursor: not-allowed; | ||
color: $pt-text-color-disabled; |
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.
!important
s here, with a nice comment explaining how important it is
chatted with @giladgray and trying with |
color: $pt-dark-text-color-disabled; | ||
} | ||
} | ||
|
||
@mixin menu-item-intent($text-color: $pt-intent-text-colors) { |
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.
this should be text-colors
(plural)
Fixes #389
Changes proposed in this pull request:
As per the previous discussion thread on #513.
Default hover and active states are grey
.pt-active
===:active
(background is dependent on.pt-intent-*
).pt-disabled
>.pt-active
/pt-intent-*
Update documentation
Update docs site