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

[Backport 1.x] Fix the appearance of form controls in grouped layouts #1313

Merged
merged 1 commit into from
Jul 19, 2024
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
53 changes: 53 additions & 0 deletions src-docs/src/views/form_controls/prepend_append.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {
OuiIcon,
OuiIconTip,
OuiPopover,
OuiSelect,
OuiSpacer,
OuiSwitch,
OuiText,
Expand Down Expand Up @@ -190,6 +191,58 @@ export default () => {
readOnly={isReadOnly}
aria-label="Use aria labels when no actual label is in use"
/>
<OuiSpacer />
<OuiFieldText
placeholder="Text field with select"
prepend={
<OuiFieldText
placeholder="..."
compressed={isCompressed}
disabled={isDisabled}
readOnly={isReadOnly}
aria-label="Use aria labels when no actual label is in use"
/>
}
append={
<OuiSelect
compressed={isCompressed}
disabled={isDisabled}
readOnly={isReadOnly}
value="hours"
options={[
{ value: 'hours', text: 'hours' },
{ value: 'days', text: 'days' },
{ value: 'weeks', text: 'weeks' },
]}
/>
}
compressed={isCompressed}
disabled={isDisabled}
readOnly={isReadOnly}
aria-label="Use aria labels when no actual label is in use"
/>
<OuiSpacer />
<OuiSelect
prepend="String"
compressed={isCompressed}
disabled={isDisabled}
readOnly={isReadOnly}
value="hours"
options={[
{ value: 'hours', text: 'hours' },
{ value: 'days', text: 'days' },
{ value: 'weeks', text: 'weeks' },
]}
append={
<OuiFieldText
placeholder="Select with text field"
compressed={isCompressed}
disabled={isDisabled}
readOnly={isReadOnly}
aria-label="Use aria labels when no actual label is in use"
/>
}
/>
</Fragment>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

// Force the stretch of any children so they expand the full height of the control
> *,
> .ouiFormControlLayout > *,
.ouiPopover__anchor,
.ouiButtonEmpty,
.ouiText,
Expand Down Expand Up @@ -78,6 +79,31 @@
}
}

/* Hide the box-shadow and grouping border combining */
.ouiFieldText,
.ouiFieldNumber,
.ouiFieldSearch,
.ouiFieldPassword,
.ouiSelect {
&.ouiFormControlLayout__prepend,
&.ouiFormControlLayout__append {
height: calc(100% + 2px);
margin: -1px -1px 0 1px;

&:focus {
background-position: 1px -1px;
}
}

&.ouiFormControlLayout__prepend {
margin: -1px 1px 0 -1px;

&:focus {
background-position: -1px -1px;
}
}
}

.ouiButtonIcon {
padding: 0 $ouiSizeS;
width: $ouiSizeXL;
Expand Down
Loading