-
Notifications
You must be signed in to change notification settings - Fork 510
Replace the SUI radio button in registration form #6621
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
Conversation
foxbunny
commented
Nov 20, 2024
- Implement a RadioButton component to replace the SUI radio button
- Replace usages of SUI radio button within the reigstration form inputs
- Address the issue of SingleChoiceInput needing both fieldset and non-fieldset rendering depending on the settings by modifying the renderAsFieldset option to allow a function that returns the correct value based on the settings
| <RadioButton | ||
| id={id ? `${id}-${index}` : ''} | ||
| style={{pointerEvents: 'auto'}} // keep label tooltips working when disabled | ||
| styleName="radio" |
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.
the .radio rule can now be removed from table.module.scss since it's not used anywhere else
| <Form.Radio | ||
| <RadioButton | ||
| id={id ? `${id}-${index}` : ''} | ||
| style={{pointerEvents: 'auto'}} // keep label tooltips working when disabled |
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.
This was there for a reason: When you have a registration that allows modifications even after payment (typically "until modification deadline"), and changing the field would result in a price change on an already-paid registration, we show this indicator. By removing this, this tooltip on the ⚠ sign no longer shows up:
This change fixes the behavior:
diff --git a/indico/web/client/js/react/components/RadioButton.module.scss b/indico/web/client/js/react/components/RadioButton.module.scss
index 1564d31aca..39a889b946 100644
--- a/indico/web/client/js/react/components/RadioButton.module.scss
+++ b/indico/web/client/js/react/components/RadioButton.module.scss
@@ -11,6 +11,7 @@
display: inline-flex;
gap: var(--content-gap-normal);
align-items: center;
+ pointer-events: auto;
}
.radio {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.
- It should be a toggletip not a tooltip.
- It's illegal for a label to contain multiple interactive elements for obvious reasons.
Therefore I'll render the toggletip separately, outside the label, and this hack won't be needed.
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.
OK, will you add it to this PR?
PS: The hack might be needed nonetheless, just on another element, since the SUI Field applies pointer-events: none; for disabled fields. But let's see ;)
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.
I swear "semantic" is a misnomer. :) Anyway, I'll add it to this PR. If I end up hacking something at least I'll be able to move it to the CSS where it belongs.
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.
Looks like I'll be doing this in a separate PR after all. I've cleaned up the CSS a bit to get this to work in a more generic way that covers all fieldsets.
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.
I'll do a separate PR for the toggletip bit.
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.
OK, but I can't merge this PR until the other fix is ready as well (especially now that the icon itself is also gone)
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.
What do you mean by "icon is gone"? Can you give me a screenshot?
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.
label={<ChoiceLabel choice={c} management={management} paid={isPaidChoice(c)} />}
You removed this line and replaced it with the plain label={c.caption}. The ChoiceLabel component is also responsible for showing the warning icon when the field is locked.
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.
Hmm, I thought I reverted that, but it looks like the build just crashed. My bad.
- Implement a RadioButton component to replace the SUI radio button - Replace usages of SUI radio button within the reigstration form inputs - Address the issue of SingleChoiceInput needing both fieldset and non-fieldset rendering depending on the settings by modifying the renderAsFieldset option to allow a function that returns the correct value based on the settings - Remove redundant .radio rule
- Fix SUI styles for disabled controls affecting fieldsets - Add disabled attribute to fieldsets so they can be targeted in that state - Add a name attribute to radio buttons so they behave properly as a group
I wasn't able to reproduce this, but I added
The idea is that it roughly matches the checkbox size. It's still a bit small as far as recommended click target size goes, and normally I would add some padding around it to compensate, but it would only work if we could make the font sizes a bit larger overall (at least 100% of the default size) which we currently can't. So this is a compromise size. |
Fair enough 👍
It still happens and I don't really know why but it seems to have something to do with fractional widths. |
|
To me both looks a bit off and pixelated, but that's probably a combination of how your browser renders it, the compression of the image, etc. At any rate, I don't do pixel values and there's a good reason for that. There's currently no advantage in using em/rem over PX because the base stylesheet is broken, but once we get around to fixing that, it will make all the difference in the world. I wouldn't make exceptions because some browsers render poorly at the sub pixel level. |
|
@ThiefMaster Do you want me to do anything else with this PR? I'm sort of needing it for the error messages PR and also to take care of the toggle tip one. The first one is blocked by this, and the second one will be easier to do once this is merged. |
|
The real question is do we want to give up hope of having a fully responsive layout (which is an a11y requirement) at some point in future because this doesn't render correctly on some machines. What's the priority. As far as I'm aware you can't have it both ways. You're either always using relative units or you're not. Can't mix and match, and can't have full responsiveness with pixel units. |
|
Is there any way we could use something like |
|
The optimal solution is to simply give it more pixels to work with to begin with. However, that means larger text as well, and that means fully responsive layout is a must. That's still a long way out. I haven't heard about any round() that would round to the nearest pixel. In a layout that uses all relative units, that would probably be a bit too unpredictable to be useful. |
round looks like it can do it but I just threw it out there as a possibility, I've never used it myself. If you think it's not possible to get around those sub-pixel rendering issues, I trust your judgement :) |
It only rounds the value, and doesn't perform unit conversion (afaik), so it's not quite the same. What you're looking for is something like |
|
Is there anything you still need to do in this PR? Otherwise, I think it's looking good :) |
|
No, I'm good |
- Implement a RadioButton component to replace the SUI radio button - Replace usages of SUI radio button within the registration form inputs - Address the issue of SingleChoiceInput needing both fieldset and non-fieldset rendering depending on the settings by modifying the renderAsFieldset option to allow a function that returns the correct value based on the settings - Remove redundant .radio rule - Fix SUI styles for disabled controls affecting fieldsets - Add disabled attribute to fieldsets so they can be targeted in that state - Add a name attribute to radio buttons so they behave properly as a group
- Implement a RadioButton component to replace the SUI radio button - Replace usages of SUI radio button within the registration form inputs - Address the issue of SingleChoiceInput needing both fieldset and non-fieldset rendering depending on the settings by modifying the renderAsFieldset option to allow a function that returns the correct value based on the settings - Remove redundant .radio rule - Fix SUI styles for disabled controls affecting fieldsets - Add disabled attribute to fieldsets so they can be targeted in that state - Add a name attribute to radio buttons so they behave properly as a group
- Implement a RadioButton component to replace the SUI radio button - Replace usages of SUI radio button within the registration form inputs - Address the issue of SingleChoiceInput needing both fieldset and non-fieldset rendering depending on the settings by modifying the renderAsFieldset option to allow a function that returns the correct value based on the settings - Remove redundant .radio rule - Fix SUI styles for disabled controls affecting fieldsets - Add disabled attribute to fieldsets so they can be targeted in that state - Add a name attribute to radio buttons so they behave properly as a group







