Skip to content

FormControl refactor/cleanup #2114

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

Merged
merged 46 commits into from
Jun 30, 2022
Merged

FormControl refactor/cleanup #2114

merged 46 commits into from
Jun 30, 2022

Conversation

langermank
Copy link
Contributor

@langermank langermank commented Jun 2, 2022

What are you trying to accomplish?

Slight refactor and simplification for all Form components (based off the new app header styles).

  • Instead of using grid slots for leading/trailing items, I'm using position: absolute and specific inline padding for fields.
  • Checkbox and Radio have been refactored to use pure CSS instead of SVG for pseudo field styling

This will correspond with the new Rails forms framework, but I added some stories for easier visual testing.

Can these changes ship as is?

This markup hasn't been released yet in PVC/dotcom, so we're safe to make breaking changes.

  • Yes, this PR does not depend on additional changes. 🚢

TODO:

  • Test and cleanup animations/transitions
  • Add styles for Windows High Contrast + test

@changeset-bot
Copy link

changeset-bot bot commented Jun 2, 2022

🦋 Changeset detected

Latest commit: d3c516c

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

@langermank langermank temporarily deployed to github-pages June 19, 2022 18:07 Inactive
@langermank langermank changed the title Checkbox + Radio updates FormControl refactor/cleanup Jun 19, 2022
@langermank langermank temporarily deployed to github-pages June 19, 2022 18:32 Inactive
&.FormControl-fieldWrap--input-trailingAction {
grid-template-columns: var(--base-size-16, 16px) minmax(0, auto) min-content;
// show vertical divider line between field and button
&::before {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should this divider line be an optional prop?

input field with divider line between button

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, if you can describe when the line should/should not be used.

Also: we don't have this style as an option in PRC. Is this to support a legacy style? Or is this a current pattern we need to support?

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 came from @vdepizzol design for the new AppHeader, so a new pattern. We were thinking it might make sense to recommend it for fields that have a secondary action, not a clear button as you see in my screenshot. We can help address this in the form interface guidelines once this ships!

Copy link
Contributor

Choose a reason for hiding this comment

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

So if this isn't a clear button, what does it do?

@langermank langermank marked this pull request as ready for review June 19, 2022 18:37
@langermank langermank requested a review from a team as a code owner June 19, 2022 18:37
@langermank langermank temporarily deployed to github-pages June 19, 2022 18:43 Inactive
@langermank langermank temporarily deployed to github-pages June 21, 2022 15:04 Inactive
}
// extend touch target
&::after {
@include minTouchTarget(var(--primer-control-medium-size, 32px), var(--primer-control-medium-size, 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.

@mperrotti I extended the touch target to handle that gap between label/input (and to extend a bit beyond the tiny input) 🌸

@langermank langermank temporarily deployed to github-pages June 29, 2022 23:22 Inactive
@github-actions github-actions bot temporarily deployed to Storybook Preview June 29, 2022 23:23 Inactive
@github-actions github-actions bot temporarily deployed to Storybook Preview June 29, 2022 23:55 Inactive
@langermank langermank temporarily deployed to github-pages June 30, 2022 00:01 Inactive
@github-actions github-actions bot temporarily deployed to Storybook Preview June 30, 2022 00:01 Inactive
@langermank langermank temporarily deployed to github-pages June 30, 2022 17:22 Inactive
@github-actions github-actions bot temporarily deployed to Storybook Preview June 30, 2022 17:23 Inactive
@langermank langermank temporarily deployed to github-pages June 30, 2022 19:17 Inactive
@github-actions github-actions bot temporarily deployed to Storybook Preview June 30, 2022 19:18 Inactive
@langermank
Copy link
Contributor Author

Windows High Contrast mode testing from @ichelsea:

radio field selected in high contrast mode

checkbox checked in high contrast mode

@github-actions github-actions bot temporarily deployed to Storybook Preview June 30, 2022 21:27 Inactive
@github-actions github-actions bot temporarily deployed to Storybook Preview June 30, 2022 21:29 Inactive
@@ -96,8 +96,6 @@ button,
[role='button'],
input[type='radio'],
input[type='checkbox'] {
transition: 80ms cubic-bezier(0.33, 1, 0.68, 1);
transition-property: color, background-color, box-shadow, border-color;
Copy link
Member

Choose a reason for hiding this comment

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

This might fix a bunch of the transition bugs we've seen? 🤩

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 think so.. I feel a little worried deleting this but its probably fine? Just a transition 😅

Copy link
Member

Choose a reason for hiding this comment

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

I don't believe there was functionality relying on this

@langermank langermank merged commit facb968 into main Jun 30, 2022
@langermank langermank deleted the checkbox-radio branch June 30, 2022 21:37
@primer-css primer-css mentioned this pull request Jun 30, 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.

6 participants