Skip to content

FormControl refactor/cleanup - #2114

Merged
langermank merged 46 commits into
mainfrom
checkbox-radio
Jun 30, 2022
Merged

FormControl refactor/cleanup#2114
langermank merged 46 commits into
mainfrom
checkbox-radio

Conversation

@langermank

@langermanklangermank commented Jun 2, 2022

Copy link
Copy Markdown
Contributor

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

changeset-botBot commented Jun 2, 2022

Copy link
Copy Markdown

🦋 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
NameType
@primer/cssPatch

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
@langermanklangermank changed the title Checkbox + Radio updatesFormControl refactor/cleanupJun 19, 2022
@langermank
langermank temporarily deployed to github-pages June 19, 2022 18:32 Inactive
Comment threadsrc/forms/FormControl.scss Outdated
Comment threadsrc/forms/FormControl.scss Outdated
&.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
Copy Markdown
ContributorAuthor

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
Copy Markdown
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
Copy Markdown
ContributorAuthor

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
Copy Markdown
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 ownerJune 19, 2022 18:37
@langermank
langermank temporarily deployed to github-pages June 19, 2022 18:43 Inactive
Comment thread.changeset/neat-sloths-march.md Outdated
Comment threaddocs/src/stories/components/Experimental/Forms/Checkbox.stories.jsx Outdated
Comment threaddocs/src/stories/components/Experimental/Forms/Checkbox.stories.jsx Outdated
Comment threadsrc/forms/FormControl.scss Outdated
Comment threadsrc/forms/FormControl.scss Outdated
Comment threadsrc/forms/FormControl.scss Outdated
Comment threadsrc/forms/FormControl.scss Outdated
Comment threadsrc/forms/FormControl.scss Outdated
@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
Copy Markdown
ContributorAuthor

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-actionsBot temporarily deployed to Storybook Preview June 29, 2022 23:23 Inactive
@github-actions
github-actionsBot 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-actionsBot 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-actionsBot 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-actionsBot temporarily deployed to Storybook Preview June 30, 2022 19:18 Inactive
@langermank

Copy link
Copy Markdown
ContributorAuthor

Windows High Contrast mode testing from @ichelsea:

radio field selected in high contrast mode

checkbox checked in high contrast mode

@github-actions
github-actionsBot temporarily deployed to Storybook Preview June 30, 2022 21:27 Inactive
@github-actions
github-actionsBot temporarily deployed to Storybook Preview June 30, 2022 21:29 Inactive
Comment threadsrc/base/base.scss
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
Copy Markdown
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
Copy Markdown
ContributorAuthor

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
Copy Markdown
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 mainJun 30, 2022
@langermank
langermank deleted the checkbox-radio branch June 30, 2022 21:37
@primer-cssprimer-css mentioned this pull request Jun 30, 2022
Sign up for freeto 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

@langermank@jonrohan@simurai@camertron@mperrotti@actions-user