-
Notifications
You must be signed in to change notification settings - Fork 841
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
Fixing styles for euiKeyPadMenu
#8294
base: eui-theme/borealis
Are you sure you want to change the base?
Changes from all commits
f7a4139
351b99a
382d895
900dc3a
eb1837f
ed3123e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
- Updates styles for keypad menu in Borealis | ||
|
||
**Accessibility** | ||
|
||
- Made keypad menu items in Dark mode visible on hover | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Was this actually done? I don't see any dark mode specific changes 🤔 |
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,67 +23,95 @@ import { euiKeyPadMenuVariables } from './key_pad_menu.styles'; | |
export const euiKeyPadMenuItemStyles = (euiThemeContext: UseEuiTheme) => { | ||
const { euiTheme } = euiThemeContext; | ||
const { euiKeyPadMenuSize } = euiKeyPadMenuVariables(euiThemeContext); | ||
const hasVisColorAdjustment = euiTheme.flags?.hasVisColorAdjustment; | ||
|
||
return { | ||
euiKeyPadMenuItem: css` | ||
display: block; | ||
padding: ${euiTheme.size.xs}; | ||
${logicalSizeCSS(euiKeyPadMenuSize)} | ||
border-radius: ${euiTheme.border.radius.medium}; | ||
color: ${euiTheme.colors.text}; /* Override possible link color */ | ||
color: ${euiTheme.colors | ||
.textParagraph}; /* Override possible link color */ | ||
|
||
${euiCanAnimate} { | ||
transition: background-color ${euiTheme.animation.fast} ease-in, | ||
box-shadow ${euiTheme.animation.fast} ease-in; | ||
} | ||
`, | ||
enabled: css` | ||
/* stylelint-disable no-extra-semicolons */ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We can remove this comment by rewriting the styles a bit. Generally assuring the style rule is set and only values are condition seems to work better in those cases. |
||
&:hover, | ||
&:focus, | ||
&:focus-within { | ||
cursor: pointer; | ||
text-decoration: underline; | ||
${euiShadow(euiThemeContext, 's')} | ||
|
||
${euiCanAnimate} { | ||
.euiKeyPadMenuItem__icon { | ||
transform: translateY(0); | ||
} | ||
} | ||
${hasVisColorAdjustment | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here we can prevent the Emotion-related semicolon lint error by separating multiline styles into a standalone variable. const focusTransformStyles = `
${euiShadow(euiThemeContext, 's')};
${euiCanAnimate} {
.euiKeyPadMenuItem__icon {
transform: translateY(0);
}
}
`;
// usage
${hasVisColorAdjustment
? focusTransformStyles
: `background-color: ${euiTheme.colors.backgroundBaseInteractiveHover}`} |
||
? ` | ||
${euiShadow(euiThemeContext, 's')} | ||
|
||
${euiCanAnimate} { | ||
.euiKeyPadMenuItem__icon { | ||
transform: translateY(0); | ||
} | ||
}` | ||
: ` | ||
background-color: ${euiTheme.colors.backgroundBaseInteractiveHover}; | ||
`} | ||
} | ||
|
||
&:focus { | ||
background-color: ${euiTheme.focus.backgroundColor}; | ||
box-shadow: none; | ||
|
||
${hasVisColorAdjustment | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We can prevent the lint error by using it this way:
|
||
? ` | ||
background-color: ${euiTheme.focus.backgroundColor}; | ||
` | ||
: ` | ||
background-color: ${euiTheme.colors.backgroundBaseInteractiveHover}; | ||
`} | ||
} | ||
`, | ||
selected: css` | ||
color: ${euiTheme.colors.title}; | ||
background-color: ${euiTheme.focus.backgroundColor}; | ||
color: ${euiTheme.colors.textHeading}; | ||
|
||
${hasVisColorAdjustment | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's update to this to prevent the lint error: background-color: ${hasVisColorAdjustment
? euiTheme.focus.backgroundColor
: ''}; |
||
? ` | ||
background-color: ${euiTheme.focus.backgroundColor}; | ||
` | ||
: ``} | ||
|
||
&, | ||
&:hover, | ||
&:focus, | ||
&:focus-within { | ||
color: ${euiTheme.colors.primaryText}; | ||
color: ${euiTheme.colors.textPrimary}; | ||
|
||
${hasVisColorAdjustment | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's update to this to prevent the lint error: background-color: ${!hasVisColorAdjustment
? euiTheme.colors.backgroundBaseInteractiveSelect
: ''}; |
||
? `` | ||
: `background-color: ${euiTheme.colors.backgroundBaseInteractiveSelect};`} | ||
} | ||
`, | ||
disabled: { | ||
disabled: css` | ||
cursor: not-allowed; | ||
color: ${euiTheme.colors.disabledText}; | ||
color: ${euiTheme.colors.textDisabled}; | ||
|
||
.euiKeyPadMenuItem__icon { | ||
filter: grayscale(100%); | ||
|
||
${hasVisColorAdjustment ? `filter: grayscale(100%);` : ``} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We can update to: filter: ${hasVisColorAdjustment ? 'grayscale(100%)' : ''}; |
||
svg * { | ||
fill: ${euiTheme.colors.disabledText}; | ||
fill: ${euiTheme.colors.textDisabled}; | ||
} | ||
} | ||
`, | ||
selected: css` | ||
background-color: ${euiTheme.components | ||
.keyPadMenuItemBackgroundDisabledSelect}; | ||
selected: hasVisColorAdjustment | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's update this to ensure that all styles are part of the Emotion selected: css`
background-color: ${hasVisColorAdjustment
? euiTheme.components.keyPadMenuItemBackgroundDisabledSelect
: euiTheme.colors.backgroundBaseDisabled};
` |
||
? css` | ||
background-color: ${euiTheme.components | ||
.keyPadMenuItemBackgroundDisabledSelect}; | ||
` | ||
: ` | ||
background-color: ${euiTheme.colors.backgroundBaseDisabled}; | ||
`, | ||
}, | ||
}; | ||
|
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.
We don't add changelogs to changes on eui-theme/borealis as it's a feature branch.
You can add the 'skip-chagelog` label.
We'll add a changelog when merging Borealis to main for any relevant changes.