Skip to content

Commit

Permalink
[EuiComboBox] Fixed disabled pills and text contrast (#4901)
Browse files Browse the repository at this point in the history
* Fixed `EuiComboBox` disabled pills and text contrast

* euiFormControlDisabledTextStyle mixin

* Overriding cursor text that displays on hover for combo boxes with multiple pills

* Adding disabled text styles to placeholder
  • Loading branch information
elizabetdev authored Jun 23, 2021
1 parent 49c19ed commit e43e585
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 11 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

- Fixed `EuiRange` container expansion due to negative margin value ([#4815](https://github.com/elastic/eui/pull/4815))
- Fixed `EuiRange` ticks position to better align with thumbs ([#4815](https://github.com/elastic/eui/pull/4815))
- Fixed `EuiComboBox` disabled pills and text contrast ([#4901](https://github.com/elastic/eui/issues/4901))
- Fixed `EuiDataGrid` footer and header rows jumps in Firefox ([#4869](https://github.com/elastic/eui/issues/4869))
- Fixed shaded colors of `EuiButtonIcon` ([#4874](https://github.com/elastic/eui/pull/4874))
- Fixed `pageHeader` display in `EuiPageTemplate` when template is `empty` or `default` ([#4905](https://github.com/elastic/eui/pull/4905))
Expand Down
19 changes: 12 additions & 7 deletions src-docs/src/views/combo_box/colors.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React, { useState } from 'react';

import { EuiComboBox } from '../../../../src/components';
import { euiPaletteColorBlindBehindText } from '../../../../src/services';
import { DisplayToggles } from '../form_controls/display_toggles';

const visColorsBehindText = euiPaletteColorBlindBehindText();
const optionsStatic = [
Expand Down Expand Up @@ -86,12 +87,16 @@ export default () => {
};

return (
<EuiComboBox
placeholder="Select or create options"
options={options}
selectedOptions={selectedOptions}
onChange={onChange}
onCreateOption={onCreateOption}
/>
/* DisplayToggles wrapper for Docs only */
<DisplayToggles canDisabled={false} canReadOnly={false} canIsDisabled>
<EuiComboBox
placeholder="Select or create options"
options={options}
selectedOptions={selectedOptions}
onChange={onChange}
onCreateOption={onCreateOption}
isDisabled
/>
</DisplayToggles>
);
};
2 changes: 1 addition & 1 deletion src-docs/src/views/combo_box/combo_box.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export default () => {

return (
/* DisplayToggles wrapper for Docs only */
<DisplayToggles canDisabled={false} canReadOnly={false}>
<DisplayToggles canDisabled={false} canReadOnly={false} canIsDisabled>
<EuiComboBox
placeholder="Select or create options"
options={options}
Expand Down
4 changes: 3 additions & 1 deletion src-docs/src/views/combo_box/single_selection.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,16 @@ export default () => {
canDisabled={false}
canReadOnly={false}
canLoading={false}
canPrepend
canPrepend={false}
canIsDisabled
canAppend>
<EuiComboBox
placeholder="Select a single option"
singleSelection={{ asPlainText: true }}
options={options}
selectedOptions={selectedOptions}
onChange={onChange}
isDisabled
/>
</DisplayToggles>
);
Expand Down
12 changes: 12 additions & 0 deletions src/components/combo_box/_combo_box.scss
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,19 @@

&.euiComboBox-isDisabled {
.euiComboBox__inputWrap {
// sass-lint:disable-block no-vendor-prefixes
@include euiFormControlDisabledStyle;
-webkit-text-fill-color: unset; // overrides $euiFormControlDisabledColor because the color doesn't work with multiple background colors
}

.euiComboBoxPlaceholder,
.euiComboBoxPill--plainText {
@include euiFormControlDisabledTextStyle;
}

// overrides the `cursor: text;` that displays on hover for combo boxes that allow multiple pills
.euiComboBox__inputWrap:not(.euiComboBox__inputWrap--noWrap):hover {
cursor: not-allowed;
}
}

Expand Down
8 changes: 6 additions & 2 deletions src/global_styling/mixins/_form.scss
Original file line number Diff line number Diff line change
Expand Up @@ -194,11 +194,15 @@
background-size: 100%;
}

@mixin euiFormControlDisabledStyle {
@mixin euiFormControlDisabledTextStyle {
// sass-lint:disable-block no-vendor-prefixes
cursor: not-allowed;
color: $euiFormControlDisabledColor;
-webkit-text-fill-color: $euiFormControlDisabledColor; // Required for Safari
}

@mixin euiFormControlDisabledStyle {
@include euiFormControlDisabledTextStyle;
cursor: not-allowed;
background: $euiFormBackgroundDisabledColor;
box-shadow: inset 0 0 0 1px $euiFormBorderDisabledColor;

Expand Down

0 comments on commit e43e585

Please sign in to comment.