-
Notifications
You must be signed in to change notification settings - Fork 194
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
fix: blank field group docs and read-only radio alignment #3164
base: main
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: 3054d94 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
Fixes the Docs page for Field group displaying blank, because the template lost its default arg value for items.
Correct an issue with the alignment of a readonly radio's label element within field group and flex layouts. The use of `auto` on the margin was previously pushing the label element all the way to the opposite side when within a field group.
ed577d2
to
3054d94
Compare
🚀 Deployed on https://pr-3164--spectrum-css.netlify.app |
File metricsSummaryTotal size: 4.31 MB* Table reports on changes to a package's main file. Other changes can be found in the collapsed Details section below.
Detailsradio
* Results are not gzipped or minified. * An ASCII character in UTF-8 is 8 bits or 1 byte. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Like you said, 2 for 1! The radio margin-inline-start
fix realigns everything properly for ltr and rtl. The only we should do is pass some checkboxes to the checkbox stories! Thanks for cleaning this up!
(passthroughs, context) => Radio({ | ||
...passthroughs, | ||
id: "apple", | ||
label: "Apples are best", | ||
customClasses: ["spectrum-FieldGroup-item"], | ||
}, context), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, does the toggle for inputType
need to do anything else but change the role
from radiogroup
to group
? It's doing that right now, all is good- I just expected it to change the component shown, but that seems like work for another PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Re: only getting radios for control group now--this means our control for radios vs. checkboxes is also out of order (and has been for awhile) 😕 Our template doesn't really support switching based on inputType
the way it did before, so I wonder if it'd be necessary to create separate stories for a checkbox group and radio group? That could easily be a separate effort outside of this PR if it doesn't seem doable here though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now that you've brought the Docs back on FieldGroup, there are lots of other things going on here with the controls particularly that have my attention. Here's what I've noticed (I already mentioned some of these below):
- We have a stray
label
control in the controls - We lost the Help text, which maybe is ok (although we are testing it here in Chromatic, so it seems like we ought to keep it), but since that was the only thing that visibly changed when the
invalid
control is turned on, now theinvalid
control doesn't appear to do anything. - We gained a
required
control at some point after the docs to storybook for this was completed and that doesn't seem to do anything, I think maybe we just need to pass that arg down to the FieldLabel in the template. - Our controls for checkbox/radio don't do anything, we can only see radios
- The testing preview does show checkboxes and radios but shows checkboxes only with horizontal positioning (and doesn't show radios), do we think this is sufficient to test them? It feels to me like we could be missing something by not testing radios and checkboxes in all positions, but I could be convinced otherwise.
Addressing these separately would definitely be ok as far as I'm concerned since these aren't things that broke in this PR and they weren't in the original scope of the work, so I don't know that all of this needs to be fixed before we merge, but definitely all things we should address with fieldgroup at some point!
Also I'm going to mention the docs to storybook PR for fieldgroup here and link the preview for easy reference in case we want to go back and see how it looked before when it worked: #2827
@@ -62,6 +62,27 @@ export default { | |||
inputType: "radio", | |||
labelPosition: "top", | |||
layout: "vertical", | |||
label: "Select one of the following options:", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(passthroughs, context) => Radio({ | ||
...passthroughs, | ||
id: "apple", | ||
label: "Apples are best", | ||
customClasses: ["spectrum-FieldGroup-item"], | ||
}, context), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Re: only getting radios for control group now--this means our control for radios vs. checkboxes is also out of order (and has been for awhile) 😕 Our template doesn't really support switching based on inputType
the way it did before, so I wonder if it'd be necessary to create separate stories for a checkbox group and radio group? That could easily be a separate effort outside of this PR if it doesn't seem doable here though.
Description
Includes two small fixes:
items
in its Template, causing nothing to render within the field group markup.margin-inline-start
being set toauto
instead of0
for read-only. In a flex container,auto
on the margin of a flex item will automatically extend its specified margin to occupy the extra space.How and where has this been tested?
Please tag yourself on the tests you've marked complete to confirm the tests have been run by someone other than the author.
Validation steps
Regression testing
Validate:
Screenshots
Read-only bug. Previous behavior:
Fixed behavior:
To-do list