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

Menu item hover / active states (including with pt-intent-*) #565

Merged
merged 14 commits into from
Feb 3, 2017

Conversation

leebyp
Copy link
Contributor

@leebyp leebyp commented Jan 28, 2017

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

&#{$disabled-selector} {
color: $pt-dark-text-color-disabled;
}
}

@mixin menu-item-intents($text-color: $pt-intent-text-colors) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@llorca
Copy link
Contributor

llorca commented Jan 30, 2017

Still don't feel great about .pt-selected... We're introducing a new modifier here. I feel like we should make it work with .pt-active.

@pkwi any thoughts on text and background colors?

@blueprint-bot
Copy link

fix linting

Preview: docs | table
Coverage: core | datetime

@blueprint-bot
Copy link

remove pt-selected modifier

Preview: docs | table
Coverage: core | datetime

@blueprint-bot
Copy link

use intent-primary active in doc menu items

Preview: docs | table
Coverage: core | datetime

@leebyp leebyp changed the title (WIP) Menu item pt-selected and hover / active states for pt-intent-* (WIP) Menu item hover / active states (including with pt-intent-*) Jan 31, 2017
@leebyp leebyp changed the title (WIP) Menu item hover / active states (including with pt-intent-*) Menu item hover / active states (including with pt-intent-*) Jan 31, 2017
@blueprint-bot
Copy link

Update usage docs

Preview: docs | table
Coverage: core | datetime

@pkwi
Copy link
Contributor

pkwi commented Jan 31, 2017

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.

@leebyp
Copy link
Contributor Author

leebyp commented Feb 1, 2017

@llorca @giladgray @cmslewis we seem pretty solid on this setup, good to review!

@dmackerman
Copy link
Contributor

Agreed with @pkwi on the Intents. The docs preview looks great!

&::before,
&::after,
.pt-menu-item-label {
color: $color;
Copy link
Contributor

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)

Copy link
Contributor Author

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 {
Copy link
Contributor

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 is nth(map-get($button-intents, $intent), 1)
  • &:hover:active, .pt-active:active is nth(map-get($button-intents, $intent), 2)

Copy link
Contributor Author

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.

@blueprint-bot
Copy link

use normal intent colors for icons

Preview: docs | landing | table
Coverage: core | datetime

@blueprint-bot
Copy link

update colors for pt-active with pt-intent

Preview: docs | landing | table
Coverage: core | datetime

color: inherit;

&:not(#{$disabled-selector})#{$hover-selector} {
Copy link
Contributor

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,
Copy link
Contributor

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;
Copy link
Contributor

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) {
Copy link
Contributor

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.

Copy link
Contributor Author

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,
Copy link
Contributor

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 {
Copy link
Contributor

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;
Copy link
Contributor

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;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

!importants here, with a nice comment explaining how important it is

@leebyp
Copy link
Contributor Author

leebyp commented Feb 3, 2017

chatted with @giladgray and trying with !important to overrride. noting that if you use .pt-disabled that's what you're buying into.

@blueprint-bot
Copy link

use important instead of convoluted css selectors

Preview: docs | landing | table
Coverage: core | datetime

color: $pt-dark-text-color-disabled;
}
}

@mixin menu-item-intent($text-color: $pt-intent-text-colors) {
Copy link
Contributor

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)

@blueprint-bot
Copy link

cleanup

Preview: docs | landing | table
Coverage: core | datetime

@leebyp leebyp merged commit 6050dde into master Feb 3, 2017
@leebyp leebyp deleted the bl/menu-item-pt-selected branch February 3, 2017 21:45
@giladgray giladgray mentioned this pull request Feb 3, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants