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

[Select] consolidate se23 styles #10081

Merged
merged 2 commits into from
Aug 18, 2023
Merged

[Select] consolidate se23 styles #10081

merged 2 commits into from
Aug 18, 2023

Conversation

gwyneplaine
Copy link
Contributor

@gwyneplaine gwyneplaine commented Aug 16, 2023

WHY are these changes introduced?

Fixes #9963

WHAT is this pull request doing?

  • Change control-height to be 32px
  • Select consolidate se23 styles

How to 🎩

🎩 checklist

@@ -1,5 +1,5 @@
@function control-height() {
@return 36px;
@return 32px;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Value ends up being used in TextField, Select and ResourceList. The first two override the value to be 32px with the feature flag enabled so they are not affected by this change.

The third, ResourceList, doesn't override this style. However it appears its being used as a min-height value, and (from what I can see) doesn't result in any visual change to the ResourceList component.

Before:
Screenshot 2023-08-16 at 5 27 55 pm

After:
Screenshot 2023-08-16 at 5 28 01 pm

Additionally, insofar as the logic described in the following issue around variable heights. It would appear that Select leverages line-height and font-size to enforce a height of 32px on larger screens and 36px on smaller ones. So defaulting the min-height specified in the control-height mixin to the minimum of 32px appears to be the right thing to do. At least until we address / resolve the behaviour outlined in the above linked issue. (cc @jesstelford)

Copy link
Contributor

@sophschneider sophschneider left a comment

Choose a reason for hiding this comment

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

Not sure whats going on with Error but it has a double focus ring. Other than that the tophat looked good!

Screenshot 2023-08-16 at 11 43 40 AM

@gwyneplaine
Copy link
Contributor Author

Not sure whats going on with Error but it has a double focus ring. Other than that the tophat looked good!

Screenshot 2023-08-16 at 11 43 40 AM

Looks like i didn't remove a focus-ring mixin invocation, fixed ty for the catch 🥇

@sophschneider
Copy link
Contributor

hmm now the focus ring isn't working for any of the selects :( https://5d559397bae39100201eedc1-sxmaeqinrc.chromatic.com/?path=/story/all-components-select--all maybe this commit?

Copy link
Member

@sam-b-rose sam-b-rose left a comment

Choose a reason for hiding this comment

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

Looks good! Just noticed the same issue @sophschneider pointed out about the focus ring missing.

@gwyneplaine
Copy link
Contributor Author

hmm now the focus ring isn't working for any of the selects :( https://5d559397bae39100201eedc1-sxmaeqinrc.chromatic.com/?path=/story/all-components-select--all maybe this commit?

Fixed, deleted what I thought was a duplicate selector, reverted the change 👍

@gwyneplaine gwyneplaine force-pushed the v12/9963 branch 2 times, most recently from 2f75ee9 to 1b13fbf Compare August 17, 2023 23:28
// stylelint-disable-next-line -- generated by polaris-migrator DO NOT COPY
@include focus-ring($style: 'focused');

#{$se23} & {
Copy link
Contributor

Choose a reason for hiding this comment

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

Interesting that there's not a @include no-focus-ring; to remove here. At first I though that meant the @include focus-ring($style: 'focused'); should remain, but looking at the later code, a more specific selector which does include @include no-focus-ring; wins:

.error .Input:focus-visible ~ .Backdrop {
  @include focus-ring($style: 'focused');
}
/* vs ... */
html[class~="Polaris-Summer-Editions-2023"] .Input:focus-visible ~ .Backdrop {
  @include focus-ring($style: 'focused');
  @include no-focus-ring;                /* <--- WINNER */
}

Copy link
Contributor

@jesstelford jesstelford left a comment

Choose a reason for hiding this comment

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

Oooft, control-height() strikes again!

I think your change is a good one, but I also think it leads to some other changes we should be making...

The se23 styles were modified like:

   min-height: control-height();
+  #{$se23} & {
+    min-height: 32px;
+  }

Which I think is because control-height() == 36px even in se23. Semantically, we still want those min-heights to match the control height, but the control-height() function was outdated, so hard coding a pixel value was easier (eg; in Select)

Now that your PR has updated control-height(), I think we should replace the hard coded values with the semantically correct function call in Option, TextField, and Select.

Note that Breadcrumbs looks, at first glance, to use a different value (min-height: 28px), throwing a spanner in the works. But I'm pretty certain that code will fully go away (the .Breadcrumb class isn't used in summer editions), so we can skip that one 👍

@gwyneplaine
Copy link
Contributor Author

gwyneplaine commented Aug 18, 2023

Oooft, control-height() strikes again!

I think your change is a good one, but I also think it leads to some other changes we should be making...

The se23 styles were modified like:

   min-height: control-height();
+  #{$se23} & {
+    min-height: 32px;
+  }

Which I think is because control-height() == 36px even in se23. Semantically, we still want those min-heights to match the control height, but the control-height() function was outdated, so hard coding a pixel value was easier (eg; in Select)

Now that your PR has updated control-height(), I think we should replace the hard coded values with the semantically correct function call in Option, TextField, and Select.

Note that Breadcrumbs looks, at first glance, to use a different value (min-height: 28px), throwing a spanner in the works. But I'm pretty certain that code will fully go away (the .Breadcrumb class isn't used in summer editions), so we can skip that one 👍

@jesstelford I've already made that change in Select I'm inclined to make the change to TextField and Banner in a separate PR, as presently those components aren't affected since they're still behind an se23 flag anyways.

Let me know if I've misinterpreted the ask here 👍

Copy link
Contributor

@jesstelford jesstelford left a comment

Choose a reason for hiding this comment

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

Agreed! Let's do it in a seperate PR 🚢

@gwyneplaine gwyneplaine merged commit 28f4165 into next Aug 18, 2023
13 checks passed
@gwyneplaine gwyneplaine deleted the v12/9963 branch August 18, 2023 04:30
sophschneider pushed a commit that referenced this pull request Sep 19, 2023
<!--
  ☝️How to write a good PR title:
- Prefix it with [ComponentName] (if applicable), for example: [Button]
  - Start with a verb, for example: Add, Delete, Improve, Fix…
  - Give as much context as necessary and as little as possible
  - Prefix it with [WIP] while it’s a work in progress
-->

### WHY are these changes introduced?

Fixes #9963 

<!--
  Context about the problem that’s being addressed.
-->

### WHAT is this pull request doing?

<!--
  Summary of the changes committed.

Before / after screenshots are appreciated for UI changes. Make sure to
include alt text that describes the screenshot.

If you include an animated gif showing your change, wrapping it in a
details tag is recommended. Gifs usually autoplay, which can cause
accessibility issues for people reviewing your PR:

    <details>
      <summary>Summary of your gif(s)</summary>
      <img src="..." alt="Description of what the gif shows">
    </details>
-->

<!-- ℹ️ Delete the following for small / trivial changes -->

- Change control-height to be 32px
- `Select` consolidate se23 styles

### How to 🎩

*
[Storybook](https://5d559397bae39100201eedc1-oiuqenxfoy.chromatic.com/?path=/story/all-components-select--all)
* [Prod
storybook](https://storybook.polaris.shopify.com/?path=/story/all-components-select--all)

### 🎩 checklist

- [ ] Tested on
[mobile](https://github.com/Shopify/polaris/blob/main/documentation/Tophatting.md#cross-browser-testing)
- [ ] Tested on [multiple
browsers](https://help.shopify.com/en/manual/shopify-admin/supported-browsers)
- [ ] Tested for
[accessibility](https://github.com/Shopify/polaris/blob/main/documentation/Accessibility%20testing.md)
- [ ] Updated the component's `README.md` with documentation changes
- [ ] [Tophatted
documentation](https://github.com/Shopify/polaris/blob/main/documentation/Tophatting%20documentation.md)
changes in the style guide
AnnaCheba pushed a commit to AnnaCheba/polaris that referenced this pull request Apr 22, 2024
<!--
  ☝️How to write a good PR title:
- Prefix it with [ComponentName] (if applicable), for example: [Button]
  - Start with a verb, for example: Add, Delete, Improve, Fix…
  - Give as much context as necessary and as little as possible
  - Prefix it with [WIP] while it’s a work in progress
-->

### WHY are these changes introduced?

Fixes Shopify#9963 

<!--
  Context about the problem that’s being addressed.
-->

### WHAT is this pull request doing?

<!--
  Summary of the changes committed.

Before / after screenshots are appreciated for UI changes. Make sure to
include alt text that describes the screenshot.

If you include an animated gif showing your change, wrapping it in a
details tag is recommended. Gifs usually autoplay, which can cause
accessibility issues for people reviewing your PR:

    <details>
      <summary>Summary of your gif(s)</summary>
      <img src="..." alt="Description of what the gif shows">
    </details>
-->

<!-- ℹ️ Delete the following for small / trivial changes -->

- Change control-height to be 32px
- `Select` consolidate se23 styles

### How to 🎩

*
[Storybook](https://5d559397bae39100201eedc1-oiuqenxfoy.chromatic.com/?path=/story/all-components-select--all)
* [Prod
storybook](https://storybook.polaris.shopify.com/?path=/story/all-components-select--all)

### 🎩 checklist

- [ ] Tested on
[mobile](https://github.com/Shopify/polaris/blob/main/documentation/Tophatting.md#cross-browser-testing)
- [ ] Tested on [multiple
browsers](https://help.shopify.com/en/manual/shopify-admin/supported-browsers)
- [ ] Tested for
[accessibility](https://github.com/Shopify/polaris/blob/main/documentation/Accessibility%20testing.md)
- [ ] Updated the component's `README.md` with documentation changes
- [ ] [Tophatted
documentation](https://github.com/Shopify/polaris/blob/main/documentation/Tophatting%20documentation.md)
changes in the style guide
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Select] Consolidate se23 logic and styles
4 participants