-
Notifications
You must be signed in to change notification settings - Fork 199
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
Radio Button #251
Comments
Today I started the document by making a list of references to all the concepts that remind of radio buttons in many design systems. After that I started a spreadsheet inventory to list all the concepts related to each of the components. The main points that are still not clear to me and maybe should be better defined in this beginning are:
If you look at the spredsheet, even though I have for now listed Ant Design's concepts alone, the list of concepts is already big and has the added complexity of being divided by "radio buttons" and "radio button groups". I would like any suggestion you might have for how I should handle it further. |
@leolopes moving the discussion around radio from discord to here:
Can you expound? I would expect there to be an additional section for how radio groups are tied together via the name attribute but most of the additional behaviors should be very similar outside of potentially a containing element to hold the group (assuming this is consistent across UAs/OSes/Design Systems). I have opinions on having the containing element for the group but that should be in a different issue. |
There is a bit of nuance here I think depending how this is implemented, specifically as it relates to accessibility and behavior depending on how these are built. While the browser ties inputs with a type of radio together using the name attribute, per the spec, ARIA radios behave different and are tied together by being a child of a |
I think the radio button is more complex than the checkbox because the checkbox is "standalone", while the radio button represents an option amongst other options. I see the radio button much like a "single choice select". They could almost be the same component with different appearances. In this sense, I mostly see the radio button as being part of a host component (the radio button group). By @chrisdholt 's answer, it's also evident that even well defined specifications differ in how they implement the component, let alone the different ways the other design systems do. If I personally were to define the specs for radio buttons, I would work from one level up, and consider the radio button group as the actual component, comprised of two or more radio buttons. If I'm not mistaken, the W3C specs for the radio buttons allow for standalone radio buttons, but I simply see no purpose in that. Perhaps you do? |
I updated the preliminary inventory with three other design systems: https://docs.google.com/spreadsheets/d/1addPff5gfeAIRvCeVTnT0GUD1IesCQYO8JmFzlum2Ug/edit?usp=sharing You can see there I divided the concepts between radio buttons and radio button groups. I'll keep doing this, however. Maybe when I have inventoried several design systems, I can have a clearer picture, and then I'll be able to triage concepts and come to a simpler list, like the one that is provided for the checkbox. |
As I keep listing the design systems' options for Radio/RadioGroups, I only strenghten my belief that we should treat Radio Button Groups as the actual component, instead of Radio Buttons (with maybe a host Radio Group Component). The two main reasons are:
One could argue that if a single button inside a group has a |
I agree overall, I think that there could be a starting anatomy here even if you simply scope it to the control and the indicator. To be somewhat selfish - I would like that scoped anatomy sooner than later as I'm putting together a proposal for an indicator pseudo element and that specific aspect of the indicator part and label are the same across checkbox and radio from what I can see. |
Hello @gregwhitworth, do you mean the actual radio input (the circle) and the label?
What do you mean exactly by the "anatomy"? Do you mean the same thing as the anatomy referenced here? https://open-ui.org/components/checkbox.research#anatomy If so, it's fairly simple. I would basically propose the following:
Either way, I'll keep looking into the design systems list all possible properties before doing a triage. |
Let me rectify: a label for the whole group seems very important, thus:
|
I have finished the analisys of all the design systems' properties, and now I'm going to use both the WAI-ARIA specs and the recurrence of properties among the design systems to propose a more to the point specification. |
Thanks for this - looking forward to it. And btw - with regards to the scoped anatomy I'm referring to this part:
This was the aspect that I was referring to being similar to checkbox. And thus the proposal I'm making being the same. For sure all of the behaviors given that they need to be tied together, etc will impact the overall anatomy so thank you for the time spent on this. |
Because of the need of tying the radio buttons together, I think the "Group Label" should be included in the basic anatomy, specially when we have more than one option. In case the final proposal allows groups with a single option, the group label could be optional. |
In the case of the Group Label being included in the anatomy, I think we'll want to ensure we articulate that a visual label is not technically required. The label for the group could be visible or it could be applied via an aria-label (5th bullet). A label of some sort is required, but its not always required as part of the anatomy. |
Coming back after a while, I've been reading a bit further and found this:
I think we can safely assume the requirement of more than one radio input in each group, relegating single option inputs to the checkbox type. I'll be finishing the research untill wednesday and include a preliminary proposal. Then I'll ask for some feedback on Discord. |
Hello mentor @leolopes .
For example, I simplified the number of simple text fields. But as is usually the case,there are the fields phone, email, and the rest. |
Hello @korenevskiy , how are you? It seems like the problem you are facing is not exactly related to the radio buttons structure or style itself, rather automating the way you set indexes for their names. Or at least how to handle the data on the server. To be honest, I'm not sure exactly why would you need JS for this. @gregwhitworth could confirm this, but I think it isn't exactly the scope of work for Open UI. Thanks for your message anyway! |
for each cell of the table in each of which there will be a group of radio buttons, you need to put indexes, this is required so that the names of the radio buttons are different.
or
With this layout, this code shows itself exactly the same as the radio button. |
Hi @korenevskiy , I'm sure you face a challenge on your work that deserves a good solution, and I hope we can help. I'm not sure, however, if the problem you are trying to solve with the setting of indexes is actually under the scope of the project, and I'm also not sure how the code examples you presented as the solution solve the problem. Maybe you could explain a little more how the code would work. In any case, talking about tables, you made me realize I was not accounting for radio buttons displayed in a tabular layout. I will surely make a note about it on the research document and ask for feedback on how this could be solved. |
There is a table.
As you can see, all field names have square brackets without indexes. This allows you to get an array of values on the server.
All radio buttons are linked together and the server gets only one value. In order for the server to receive the values of radio buttons in the same way as other field types, it is necessary that the fields in this column have one for each row similar to the Hidden or text type. For such a field, we specify the name in education [] as usual. And then the server receives the data array as usual.
My idea is to make a regular field work with the Text type or with the hidden type or with another type similar to radio buttons.
Thus, we get a text field that functions as a radio button.
|
In HTML, there is such a
Or a variant with buttons, but in any case there should be a tag that should be able to pass values to the field without using JS.
Here I listed the possible solutions to the same problem. |
Hello @korenevskiy , I appreciate the effort put in showing your idea. I think I now understand what you mean. Personally, I think if radio buttons behaved in such a way, it could be helpful, but I don't know how far I would go to avoid simply placing indexes on the radio buttons' names. I would appreciate your help commenting on the research document presented on the first post. Thanks! |
Hello @leolopes. I have been doing layout and programming for a very long time. But I have difficulties with the English language. |
Hi @korenevskiy , don't worry, I can understand you :) English is also not my first language. Well, I think you did the right thing by posting your idea here and even creating a separate issue for it, and I think now it's time to wait and see if it gets the attention of other people... You can also advocate for your idea around, or even in the Open UI Discord Server: https://discord.com/invite/DEWjhSw I am not very familiarized with the specification process, I'm still learning. @gregwhitworth has worked with this for longer and is basically leading the project, so he's a better source than I am. |
@leolopes
This is a great idea, but it doesn't solve the problem of placing elements in different parts of the layout. But we must kill all the hares with one shot, not just one hare. Right?
That's why I came up with the idea of using Label | A | Button so that they take over the function of radio buttons. You raised questions about the operation of radio buttons. But I believe that your questions are so complex that they cannot be applied to the previous radio buttons. Here, in fact, we are discussing a new type of field with new functions. . |
@leolopes |
Hello @korenevskiy, I read all you wrote, and I agree with your points. We may have come to a consensus about the problems that we face with radio buttons. The problem is: because I don't have experience in creating HTML specs, and I'm also marginally involved with the Open UI project, I don't actually know how to proceed from now on. I would gladly hear @gregwhitworth about it, my doubts being:
What should we do next? |
@leolopes @korenevskiy here is what I'd like to do. I'd like to get the issues raised on a telecon but I'd like to distill this large thread down to the options available and possibly sub options. @leolopes hit on one of them in number 1. Outline the problem statement and then that question so we can discuss it on a call and get agreement based on the developer/end user impacts. Then if we agreed that things should be changed (and note we wouldn't change the current ones but probably define a new one to eventually replace them) what are the possible options and pros/cons.
Can you file a PR for this and get it into Open UI? @leolopes @korenevskiy let me know if you have any questions. |
@leolopes
Tasks to be solved:
Decisions:
I came up with a new control with the
VS
And also think about all the advantages of each of the options, and all the disadvantages. |
There is also such an option. But it seems to me that this option has poor availability. And this option will be more difficult to implement than the first two. Since here the Label will actually no longer be a Label, but will be completely similar as controls. And so they are difficult to implement. |
@gregwhitworth Thank you for your answer. As soon as I can, I'll brush up the research document and outline the problem statement so it can be discussed on a telecon. I'll also prepare a PR, even though the document is not complete. I might contact you if I have questions on how better to do it. @korenevskiy , thank you for advancing on the new code proposal, but by what @gregwhitworth said, I think we should first submit the problem to be analyzed by the rest of the contributors. I'll take your suggestions into consideration while outlining the problem, but I think I'll only give further tought on the actual code proposal after we have a feedback from the team. The first thing we need to do is have them understand why we are making this proposition :) I'll get back to you |
Hello, @gregwhitworth , sorry for my delay. I've been struggling to find time. I have re-analyzed the whole discussion and then updated the document: https://docs.google.com/document/d/1-TyGOSOcyV4VOqNyUDjEQLjrtssI8cd2-BVld9cJtlo/edit?usp=sharing I kept the old explanations, because they still make sense, and then added the two main approaches under the "Proposed Anatomy" subtitles, where I explain what alternatives we face and what should be discussed. Do you think it is enough for you to discuss on a telecon? Or do you want me to first make a PR? I understand the PR should fall under the "Analysis" menu, like this page, am I right? https://open-ui.org/components/datepicker.research In the case I must make a PR, I presume I should include the problem to be discussed, right? Thanks |
@leolopes this is awesome, I would like to land that Google Doc into analysis, additionally the spreadsheet converted to a markdown table (there are online converters). I pinged you via chat but can you bring the section that is "The Problem" and down into the Github Issue rather than referencing an external doc. I would like to discuss radio in general on the call as there are a few things here:
|
As asked by @gregwhitworth, the following is the research problem laid out so we can discuss. Reading the rest of the document and discussion on this issue is still important to understand how we got to this, but the following can be enough. Proposed Anatomy - by tag hierarchyThis section shows the proposed visual constituents for the Radio Button Group, which is here considered to be the actual component, while the radio buttons are a part of the group.
The problemThe above anatomy is regular enough to be assembled in a way similar to (but more complex than) a However, by being so regular and requiring a specific HTML structure, we would lose structural flexibility. For this, here is another proposal. Proposed Anatomy - by attribute bindingIf the above proposal would accept other nodes as valid children, or at least a set of attributes that could replace some of the nodes (eg. an This could be achieved by combining table elements with radio button inputs and grouping attributes. The problemOne could say it’s exactly the same behavior we have nowadays, because the radio buttons are bound together by the Today, the structure of such semantic differential scale could be represented like this:
Each field has its
The above case creates a new tag (or an unsemantic tag with a new aria-attribute) that labels the whole group by referring to its name. Another alternative would be:
In this case the label is the actual input, and it could have an appearance of a simple text. The answers, on the othter hand, could be an alternative use for the To be discussedThe two main approaches presented above should be analysed in order to decide
|
On june 3th we had a Telecon to address the possible ways to handle the radio buttons. The key points I took from it are:
@gregwhitworth at a point mentioned that maybe we could make the semantic scale layout work with the rigid proposal (because CSS would be able to layout it very freely), but still, I think if we want to account for other kinds of really "disjointed" layouts, we should have a flexible proposal so as to not demand a tag hierarchy. Based on that all, and on my current knowledge, I'll be making both HTML proposals and PR to the repository. I will probably, however, end it on the HTML and have the other discussions (AT, ARIA, A11Y) be made after we have something more concrete to analyze. |
I created a PR for the proposal. I would like the community to validate the basic idea before going further. |
In the draft, you need to place short examples of sentences and a brief description of these examples. So that participants do not have to run through the links. |
Hi @korenevskiy , what sentences do you mean exactly? |
Examples of HTML code with the display of new attributes and properties. |
@korenevskiy Oh, those are on the Pull Request |
I was once on a forum where they ask questions to solve problems. They told me there. |
@korenevskiy , yes, I agree with you, that's why those proposals were studied, created, and put on the Pull Request, so that the community can see, comment and contribute. |
@leolopes |
Hi @korenevskiy , I'm going to take a look and let you know if I have any idea ;) |
There hasn't been any discussion on this issue for a while, so we're marking it as stale. If you choose to kick off the discussion again, we'll remove the 'stale' label. |
Just opening this issue to tell I'm going to start research work for the "radio" component.
This is the link for the document draft: https://docs.google.com/document/d/1-TyGOSOcyV4VOqNyUDjEQLjrtssI8cd2-BVld9cJtlo/edit?usp=sharing
Any contributions are welcome :)
The text was updated successfully, but these errors were encountered: