Skip to content
This repository has been archived by the owner on Mar 4, 2020. It is now read-only.

fix(radio-group): replaced label with content #287

Merged
merged 1 commit into from
Oct 3, 2018

Conversation

bmdalex
Copy link
Collaborator

@bmdalex bmdalex commented Sep 27, 2018

Radio group

This PR contains:

  • replacing label prop with content
  • making content accept react nodes as value

TODO

  • Conformance test
  • Minimal doc site example
  • Stardust base theme
  • Teams Light theme
  • Teams Dark theme
  • Teams Contrast theme
  • Confirm RTL usage
  • W3 accessibility check
  • Stardust accessibility check
  • Update glossary props table
  • Update the CHANGELOG.md

@codecov
Copy link

codecov bot commented Sep 27, 2018

Codecov Report

Merging #287 into master will increase coverage by 0.05%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #287      +/-   ##
==========================================
+ Coverage   89.49%   89.54%   +0.05%     
==========================================
  Files          62       62              
  Lines        1171     1177       +6     
  Branches      152      175      +23     
==========================================
+ Hits         1048     1054       +6     
  Misses        121      121              
  Partials        2        2
Impacted Files Coverage Δ
src/components/RadioGroup/RadioGroupItem.tsx 100% <100%> (ø) ⬆️
src/components/RadioGroup/RadioGroup.tsx 95.38% <100%> (+0.46%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ccfdbc0...e6837cb. Read the comment docs.

@bmdalex bmdalex force-pushed the fix/radio-group-fix-content branch 2 times, most recently from 111d0af to d2a8a3e Compare September 27, 2018 16:04
@bmdalex bmdalex force-pushed the fix/radio-group-fix-content branch from d2a8a3e to 8b6c080 Compare October 1, 2018 09:30
@@ -172,7 +172,7 @@ class RadioGroupItem extends AutoControlledComponent<Extendable<IRadioGroupItemP
onClick={this.handleClick}
className={classes.root}
>
<Label styles={styles.label}>
<Label styles={styles.content}>
Copy link
Contributor

@kuzhelov kuzhelov Oct 1, 2018

Choose a reason for hiding this comment

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

a bit worrying about semantics behind this nesting here. Do we really want the content (that is quite generic by its nature) to be always a children of Label (and, thus, to always reflect its styles and, what is more important, behavioural and accessibility aspects - for any arbitrary value of content that will be passed in)?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'm not changing the implementation as you can see, just the name of the prop (I should have kept the name of the styles slot to label, will revert that part).

I think this is a legitimate concern, but the nature of the radio button dictates to us that we need an icon with some content after it; maybe we should not use Label to wrap these, any suggestions?

@kuzhelov @mnajdova

Copy link
Contributor

Choose a reason for hiding this comment

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

yes, I would suggest exactly the same path as you've done - specifically, to not wrap Icon with Label (especially if we would take into account where Icon is used - it is used to 'fill' the circle area of radio input). Then it would be much easier to decouple all these parts from each other.

Not sure if we should do it in this PR or create a dedicated one as a close follow-up, but the most important thing would be, actually, if we all agree on that proposal :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'd rather do it in another PR; I'll discuss with @jurokapsiar as well to understand what are the concerns (if any) and proceed with removing Label

@bmdalex bmdalex changed the title fix(radio-groud): replaced label with content fix(radio-group): replaced label with content Oct 1, 2018
@kuzhelov kuzhelov added the needs author feedback Author's opinion is asked label Oct 1, 2018
@bmdalex bmdalex force-pushed the fix/radio-group-fix-content branch 3 times, most recently from 497e9cc to ff2c72c Compare October 1, 2018 15:07
@kuzhelov kuzhelov added 🚀 ready for review and removed needs author feedback Author's opinion is asked labels Oct 1, 2018
@bmdalex bmdalex force-pushed the fix/radio-group-fix-content branch from ff2c72c to 7cde30d Compare October 1, 2018 15:13
@@ -180,7 +180,7 @@ class Input extends AutoControlledComponent<Extendable<IInputProps>, any> {

return (
<ElementType className={classes.root} {...restProps} onChange={onChange}>
{createHTMLInput(type, {
{createHTMLInput(input || type, {
Copy link
Contributor

Choose a reason for hiding this comment

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

have we agreed to have this input prop for the Input element (like as it is in SUIR)? We've had some concerns - specifically, the fact that it makes it non-intuitive for the client what input prop of Input component is about. Maybe we should leave it for a dedicated PR?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

then we won't be able to achieve functionality of RadioGroup items that contain inputs.. Marija told we we're expected to merge a dedicated PR as well; I'm ok with removing it from here but the examples with input in this PR won't work correctly

@kuzhelov @mnajdova

Copy link
Contributor

@kuzhelov kuzhelov left a comment

Choose a reason for hiding this comment

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

generally agree with the changes made, but it seems that there is more changes than necessary to address the goal of this PR. Would rather suggest to do it step-by-step - or to discuss those additional concepts introduced, as those might raise some concerns (have expressed them in comments)

@bmdalex bmdalex force-pushed the fix/radio-group-fix-content branch 7 times, most recently from 15fa36d to aee235e Compare October 3, 2018 13:50
CHANGELOG.md Outdated Show resolved Hide resolved
@bmdalex bmdalex force-pushed the fix/radio-group-fix-content branch from aee235e to e6837cb Compare October 3, 2018 15:20
@bmdalex bmdalex merged commit d155831 into master Oct 3, 2018
@bmdalex bmdalex deleted the fix/radio-group-fix-content branch October 3, 2018 15:28
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants