You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@ahmadabdolsaheb The tailwind styles are not being applied to the custom components by default (I am running npm run develop:client command). Other CSS is applying perfectly, but not the tailwind classes.
Then, I thought to include the base.css stylesheet to the component file directly. But its giving this error TypeError: Cannot read properties of undefined (reading 'config') at getTailwindConfig
I searched on the web a bit but didn't find any solution. What am I doing wrong?
@ahmadabdolsaheb @rajgaur98 I finally had a chance to look at the current PR for this and I do have a few accessibility concerns that I will elaborate on later this week. But first I'd like to ask where this component would be used in the interface? I'm assuming it would be used for the various toggles on the Settings page? Are there any other places FCC is using toggles?
We have two types of toggles on the Settings page. Some of them perform an action immediately when toggled, such as the Night Mode toggle. These should use button elements and should be grouped in a fieldset with a legend describing what they toggle. They should also use the aria-pressed attribute on each button to indicate to screen reader users which one is currently active (one will always be false and one will always be true).
The other type of toggle is triggered when the Save button is clicked. These should use radio button inputs. They should also be grouped in a fieldset with a legend describing what they toggle.
Is this ToggleButton component intended to be used for both of these types of toggles? Or will there be a separate component for the radio button toggles?
The other type of toggle is triggered when the Save button is clicked. These should use radio button inputs. They should also be grouped in a fieldset with a legend describing what they toggle.
@bbsmooth , I couldn't find the second type of toggle that you mentioned. Could you please attach a screenshot? Thanks!
@rajgaur98 None of the toggles are currently using button elements on the Settings page. My point is that some of them should be using button elements, specifically, the toggles that change a setting immediately and don't need the Save button to be activated.
So what I'm asking here is if this component is going to have the option to use either button elements or radio button inputs? Or is this component only going to use button elements and we will create another toggle component that uses radio button inputs?
Also, issue #48913 was just opened and is suggesting we change all of the toggles on the Settings page to activate immediately and thus not require the use of the Save button. This would mean that there would be no need for the radio button input toggle (at least at this time for the Settings page). But I still think we can decide now whether this component is meant to accommodate both options or just one.
I'm not implying you need to follow this exactly. I just wanted to give a clear example of how this should work. It really is quite minimal in implementation (at least as far as the HTML is concerned). Just two buttons toggling the aria-pressed attribute (one is always set to true and the other to false). The real accessibility work is done in the fieldset/legend (which is out of scope for this component).
I'm not implying you need to follow this exactly. I just wanted to give a clear example of how this should work. It really is quite minimal in implementation (at least as far as the HTML is concerned). Just two buttons toggling the aria-pressed attribute (one is always set to true and the other to false). The real accessibility work is done in the fieldset/legend (which is out of scope for this component).
I think i got it. So, should I move forward with using roles button and not radio/switch?
And also, the fieldset will be useful in the ToggleButtonGroup component and not this ToggleButton component?
OK, I apologize, I think I may be confused about what this component really is. And I think we might not be using the terminology the same way. I was assuming that ToggleButton was referring to all of the toggles currently on the Settings page. Is this correct? Or if not, which of the toggles on the Settings page does ToggleButton refer to? Or does it not refer to any of the toggles on the Settings page and is just a building block in order to create these toggles?
The reason these distinctions are important is because even though all of the toggles on the Settings page basically look the same and are currently coded the same, they are in fact not all the same. There are actually two types of toggles on the Settings page: those that only take effect when the Save button is clicked and those that take effect immediately when the toggle is changed. This is an important distinction for accessibility and thus they must be coded differently.
OK, I apologize, I think I may be confused about what this component really is. And I think we might not be using the terminology the same way. I was assuming that ToggleButton was referring to all of the toggles currently on the Settings page. Is this correct? Or if not, which of the toggles on the Settings page does ToggleButton refer to? Or does it not refer to any of the toggles on the Settings page and is just a building block in order to create these toggles?
The reason these distinctions are important is because even though all of the toggles on the Settings page basically look the same and are currently coded the same, they are in fact not all the same. There are actually two types of toggles on the Settings page: those that only take effect when the Save button is clicked and those that take effect immediately when the toggle is changed. This is an important distinction for accessibility and thus they must be coded differently.
This implementation was intended to replace all the ToggleButtons on the settings page. And when coming up about the implementation, I didn't know the distinction you mentioned regarding accessibility.
I can think of two options:
Change all the toggles on the settings page to follow one implementation (preferably role=button?).
Or pass the role radio/button to the ToggleButton
I don't trust my judgement here on accessibility, so please suggest what should be done
There is an open issue about the toggles on the Settings page. I think we'll have to wait to see how that turns out before we can answer these questions. But at least we have a clear understanding of what this component is now. If ultimately the Settings page remains with two different types of toggle functionality then we will either need to create two separate components (one for toggles using button elements and one for toggles using radio inputs) or, as you suggest, pass in a type to this component so it can spit out the appropriate HTML based on the type.
There is an open issue about the toggles on the Settings page. I think we'll have to wait to see how that turns out before we can answer these questions. But at least we have a clear understanding of what this component is now. If ultimately the Settings page remains with two different types of toggle functionality then we will either need to create two separate components (one for toggles using button elements and one for toggles using radio inputs) or, as you suggest, pass in a type to this component so it can spit out the appropriate HTML based on the type.
It looks like we will need both types of toggles on the Settings page: those that use buttons and those that use radio button inputs (as demonstrated in my codepen links above). Whether this should be done as one ToggleButton component which can handle either type or split into two separate components I'll leave for others to decide.
Also, going by PR #48757, I think we need a three option toggle, so it would probably be a good idea to make sure the component can take two or three values (or perhaps don't put a limit on it?).
It looks like we will need both types of toggles on the Settings page: those that use buttons and those that use radio button inputs (as demonstrated in my codepen links above). Whether this should be done as one ToggleButton component which can handle either type or split into two separate components I'll leave for others to decide.
Also, going by PR #48757, I think we need a three option toggle, so it would probably be a good idea to make sure the component can take two or three values (or perhaps don't put a limit on it?).
In #48567 we are taking the value as strings, so this should work. And the role of handling multiple ToggleButtons would be carries out by the ToggleButtonGroup when it is implemented
Thank you @BalanaguYashwanth for the reminder. All prs are in the queue and are being reviewed based on priority.
As a result, tagging users would not speed up the review process.
Activity
rajgaur98 commentedon Nov 10, 2022
Hi @ahmadabdolsaheb , if everything looks good may I start with the implementation of the above?
ahmaxed commentedon Nov 15, 2022
Yes, please proceed with a pr.
rajgaur98 commentedon Nov 15, 2022
@ahmadabdolsaheb The tailwind styles are not being applied to the custom components by default (I am running
npm run develop:clientcommand). Other CSS is applying perfectly, but not the tailwind classes.Then, I thought to include the
base.cssstylesheet to the component file directly. But its giving this errorTypeError: Cannot read properties of undefined (reading 'config') at getTailwindConfigI searched on the web a bit but didn't find any solution. What am I doing wrong?
ahmaxed commentedon Nov 17, 2022
That is expected. you can ignore that message for now or create an empty postcss.config.js file in the freecodecamp's root directory.
bbsmooth commentedon Dec 27, 2022
@ahmadabdolsaheb @rajgaur98 I finally had a chance to look at the current PR for this and I do have a few accessibility concerns that I will elaborate on later this week. But first I'd like to ask where this component would be used in the interface? I'm assuming it would be used for the various toggles on the Settings page? Are there any other places FCC is using toggles?
ahmaxed commentedon Jan 3, 2023
@bbsmooth, for now only the settings page uses toggles.
bbsmooth commentedon Jan 3, 2023
@ahmadabdolsaheb Thank you.
We have two types of toggles on the Settings page. Some of them perform an action immediately when toggled, such as the Night Mode toggle. These should use
buttonelements and should be grouped in afieldsetwith alegenddescribing what they toggle. They should also use thearia-pressedattribute on each button to indicate to screen reader users which one is currently active (one will always befalseand one will always betrue).The other type of toggle is triggered when the Save button is clicked. These should use radio button inputs. They should also be grouped in a
fieldsetwith alegenddescribing what they toggle.Is this ToggleButton component intended to be used for both of these types of toggles? Or will there be a separate component for the radio button toggles?
rajgaur98 commentedon Jan 5, 2023
@bbsmooth , I couldn't find the second type of toggle that you mentioned. Could you please attach a screenshot? Thanks!
bbsmooth commentedon Jan 5, 2023
@rajgaur98 None of the toggles are currently using
buttonelements on the Settings page. My point is that some of them should be usingbuttonelements, specifically, the toggles that change a setting immediately and don't need the Save button to be activated.So what I'm asking here is if this component is going to have the option to use either
buttonelements or radio button inputs? Or is this component only going to usebuttonelements and we will create another toggle component that uses radio button inputs?Also, issue #48913 was just opened and is suggesting we change all of the toggles on the Settings page to activate immediately and thus not require the use of the Save button. This would mean that there would be no need for the radio button input toggle (at least at this time for the Settings page). But I still think we can decide now whether this component is meant to accommodate both options or just one.
bbsmooth commentedon Jan 5, 2023
I have created a codepen with an accessible working example of a two button toggle group using
buttons:Codepen: Accessible Toggle Group Using Buttons
I'm not implying you need to follow this exactly. I just wanted to give a clear example of how this should work. It really is quite minimal in implementation (at least as far as the HTML is concerned). Just two
buttons toggling thearia-pressedattribute (one is always set totrueand the other tofalse). The real accessibility work is done in thefieldset/legend(which is out of scope for this component).rajgaur98 commentedon Jan 5, 2023
I think i got it. So, should I move forward with using roles
buttonand notradio/switch?And also, the
fieldsetwill be useful in theToggleButtonGroupcomponent and not thisToggleButtoncomponent?bbsmooth commentedon Jan 5, 2023
OK, I apologize, I think I may be confused about what this component really is. And I think we might not be using the terminology the same way. I was assuming that ToggleButton was referring to all of the toggles currently on the Settings page. Is this correct? Or if not, which of the toggles on the Settings page does ToggleButton refer to? Or does it not refer to any of the toggles on the Settings page and is just a building block in order to create these toggles?
The reason these distinctions are important is because even though all of the toggles on the Settings page basically look the same and are currently coded the same, they are in fact not all the same. There are actually two types of toggles on the Settings page: those that only take effect when the Save button is clicked and those that take effect immediately when the toggle is changed. This is an important distinction for accessibility and thus they must be coded differently.
rajgaur98 commentedon Jan 6, 2023
This implementation was intended to replace all the
ToggleButtonson the settings page. And when coming up about the implementation, I didn't know the distinction you mentioned regarding accessibility.I can think of two options:
role=button?).radio/buttonto theToggleButtonI don't trust my judgement here on accessibility, so please suggest what should be done
bbsmooth commentedon Jan 6, 2023
There is an open issue about the toggles on the Settings page. I think we'll have to wait to see how that turns out before we can answer these questions. But at least we have a clear understanding of what this component is now. If ultimately the Settings page remains with two different types of toggle functionality then we will either need to create two separate components (one for toggles using
buttonelements and one for toggles using radioinputs) or, as you suggest, pass in a type to this component so it can spit out the appropriate HTML based on the type.Also, I created a codepen for toggles using radio buttons. Again, just to give an idea of how these would work.
rajgaur98 commentedon Jan 7, 2023
Thanks for the examples! Learned new things about accessibility.
bbsmooth commentedon Jan 11, 2023
It looks like we will need both types of toggles on the Settings page: those that use
buttons and those that use radio buttoninputs (as demonstrated in my codepen links above). Whether this should be done as one ToggleButton component which can handle either type or split into two separate components I'll leave for others to decide.Also, going by PR #48757, I think we need a three option toggle, so it would probably be a good idea to make sure the component can take two or three values (or perhaps don't put a limit on it?).
rajgaur98 commentedon Jan 12, 2023
https://headlessui.com/react/switch component does not offer a
typeprop, so it is not be possible to change the HTML wrt thetypeprop. But we can use https://headlessui.com/react/radio-group for thetyperadio and an HTML button for thetypebutton. I am also okay with implementing these both in HTML and not headless UIIn #48567 we are taking the
valueas strings, so this should work. And the role of handling multiple ToggleButtons would be carries out by the ToggleButtonGroup when it is implementedBalanaguYashwanth commentedon Feb 9, 2023
Hello @bbsmooth @ahmadabdolsaheb,
Can you guys review @rajgaur98 PR #48567 and close it. So that developer can save time to look into other PRs
ahmaxed commentedon Feb 17, 2023
Thank you @BalanaguYashwanth for the reminder. All prs are in the queue and are being reviewed based on priority.
As a result, tagging users would not speed up the review process.
BalanaguYashwanth commentedon Feb 17, 2023
ok