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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

More CSS updates to Autocomplete #2000

Merged
merged 9 commits into from Mar 29, 2022
Merged

Conversation

khiga8
Copy link
Contributor

@khiga8 khiga8 commented Mar 25, 2022

What are you trying to accomplish?

When updating Autocomplete PVC API and making swaps in dotcom, we saw some funkiness, particularly in the context of Form groups and Input groups.

This PR addresses the bugs we saw. Further details are in the comments.

What should reviewers focus on?

Is there a better approach? The CSS feels kinda brittle as need to support these various cases.
Definitely open to suggestions!

Are additional changes needed?

  • No, this PR should be ok to ship as is. 馃殺

@changeset-bot
Copy link

changeset-bot bot commented Mar 25, 2022

馃 Changeset detected

Latest commit: 865cd5e

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@primer/css Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@khiga8 khiga8 changed the title WIP More CSS updates to Autocomplete Mar 28, 2022
@@ -21,7 +21,7 @@
// Wrapper for the input and result elements to ensure alignment
.autocomplete-body {
position: relative;
display: inline-block;
display: inline;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was originally changed to inline-block to remediate this bug we saw in Firefox:
Screenshot of listbox overlapping with input field in firefox

Preview of bug

However, inline-block results in the listbox overflowing out of its container. See primer/view_components#1050 (comment). We found the overlap issue does not appear when testing the swapped instances in prod in FireFox. Though this bug surfaces in Primer CSS docs, we don't see it when listbox is hidden THEN appears, so I think we should move forward with this to remediate the overflow issue.

.input-group-button--autocomplete-embedded-icon {
vertical-align: bottom;
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This addresses: https://github.com/github/github/pull/214426/files#r836499311.

The changes in this file addresses an issue where button positioning is way off when autocomplete with embedded icon is inside an input group.

Comment on lines +18 to +23
.form-control.autocomplete-embedded-icon-wrap {
&:focus-within {
background-color: var(--color-canvas-default);
}
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

When an input in a .form-group is focused, it changes colors. We need to make sure that color of the parent embedded icon container also changes.

This fixes how the color is not uniform in this screenshot : https://github.com/github/github/pull/214426#discussion_r835613107

</style>
```

### Inline
Copy link
Contributor Author

Choose a reason for hiding this comment

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

It appears Inline label doesn't work within Input group. (Example of inline label within input group)

Any suggestions for making this work?

Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if there are any examples of this usage in dotcom? If not, maybe we should just not advertise that this is a combination. If people end up needing it later on, we could address then. Thoughts?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree!

@khiga8 khiga8 marked this pull request as ready for review March 28, 2022 20:59
@khiga8 khiga8 requested a review from a team as a code owner March 28, 2022 20:59
@khiga8 khiga8 requested a review from jonrohan March 28, 2022 20:59
// Autocomplete with embedded icon
.form-control.autocomplete-embedded-icon-wrap {
display: inline-flex;
padding: $spacer-1*1.25 $spacer-2;
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you also make this change for the other autocomplete form controls? $spacer-1 * 1.25

I feel like it needs a space in the math but maybe it doesn't matter 馃

Copy link
Contributor

Choose a reason for hiding this comment

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

Fixed!

@langermank langermank merged commit 264a89a into main Mar 29, 2022
@langermank langermank deleted the additional-autocomplete-updates branch March 29, 2022 20:43
@primer-css primer-css mentioned this pull request Mar 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants