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

fix(list-box): replace value attribute selectors #3411

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions packages/components/src/components/list-box/_list-box.scss
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,10 @@ $list-box-menu-width: rem(300px);
border-width: 0;
}

.#{$prefix}--list-box.#{$prefix}--list-box--inline.#{$prefix}--list-box--disabled:hover,
.#{$prefix}--list-box.#{$prefix}--list-box--inline.#{$prefix}--list-box--disabled:hover {
background-color: transparent;
}

.#{$prefix}--list-box.#{$prefix}--list-box--inline.#{$prefix}--list-box--expanded:hover {
background-color: $field-02;
}
Expand Down Expand Up @@ -263,39 +266,39 @@ $list-box-menu-width: rem(300px);
}

// populated input field
.#{$prefix}--list-box__field .#{$prefix}--text-input[value] {
.#{$prefix}--list-box__field .#{$prefix}--text-input {
padding-right: carbon--mini-units(9);
}

// invalid && populated input field
.#{$prefix}--list-box[data-invalid]
.#{$prefix}--list-box__field
.#{$prefix}--text-input[value] {
.#{$prefix}--text-input {
padding-right: rem(98px); // to account for clear input button outline
}

.#{$prefix}--list-box[data-invalid]
.#{$prefix}--list-box__field
.#{$prefix}--text-input[value]
.#{$prefix}--text-input
+ .#{$prefix}--list-box__invalid-icon {
right: rem(66px); // to account for clear input button outline
}

// empty input field
.#{$prefix}--list-box__field .#{$prefix}--text-input[value=''] {
.#{$prefix}--list-box__field .#{$prefix}--text-input--empty {
padding-right: $carbon--spacing-09;
}

// invalid && empty input field
.#{$prefix}--list-box[data-invalid]
.#{$prefix}--list-box__field
.#{$prefix}--text-input[value=''] {
.#{$prefix}--text-input--empty {
padding-right: carbon--mini-units(9);
}

.#{$prefix}--list-box[data-invalid]
.#{$prefix}--list-box__field
.#{$prefix}--text-input[value='']
.#{$prefix}--text-input--empty
+ .#{$prefix}--list-box__invalid-icon {
right: rem(40px); // to account for clear input button outline
}
Expand Down
7 changes: 1 addition & 6 deletions packages/components/src/globals/scss/_css--reset.scss
Original file line number Diff line number Diff line change
Expand Up @@ -125,12 +125,7 @@
// Chrome 62 fix
button,
select,
input[type='button'],
input[type='submit'],
input[type='reset'],
input[type='file'],
input[type='text'],
input[type='password'],
input,
Copy link
Contributor

Choose a reason for hiding this comment

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

@emyarod Is this intentional? Asking because it seems to change the specificity of the reset style for <input>.

Copy link
Member Author

Choose a reason for hiding this comment

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

@asudoh yes, in order to override browser user agent styles

Copy link
Contributor

Choose a reason for hiding this comment

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

I see, is it needed to complete this PR or was it just an issue you found?

Copy link
Member Author

Choose a reason for hiding this comment

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

since this is only a style change it's not needed to resolve the original issue but we will need to make this change so that the component uses the correct font

Copy link
Contributor

Choose a reason for hiding this comment

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

OK sounds fair enough - Thanks for clarifying!

textarea {
border-radius: 0;
font-family: inherit;
Expand Down
6 changes: 5 additions & 1 deletion packages/react/src/components/ComboBox/ComboBox.js
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,10 @@ export default class ComboBox extends React.Component {
) : null;
const wrapperClasses = cx(`${prefix}--list-box__wrapper`);
const comboBoxA11yId = `combobox-a11y-${this.comboBoxInstanceId}`;
const inputClasses = cx(`${prefix}--text-input`, {
[`${prefix}--text-input--empty`]: !this.state.inputValue,
});

// needs to be Capitalized for react to render it correctly
const ItemToElement = itemToElement;
const input = (
Expand Down Expand Up @@ -316,7 +320,7 @@ export default class ComboBox extends React.Component {
onClick: this.onToggleClick(isOpen),
})}>
<input
className={`${prefix}--text-input`}
className={inputClasses}
aria-labelledby={comboBoxA11yId}
tabIndex="0"
aria-disabled={disabled}
Expand Down