caldane
KPCKevin Powell - Community
•Created by Jonah on 10/1/2024 in #front-end
Problem with the container background
you are still trying to pass isQuizCompleted into main but it looks like it should be a use state var, like in my example above
19 replies
KPCKevin Powell - Community
•Created by Jonah on 10/1/2024 in #front-end
Problem with the container background
isQuizCompleted will always be undefined in his example
19 replies
KPCKevin Powell - Community
•Created by Jonah on 10/1/2024 in #front-end
Problem with the container background
But I am also confused because you are not exporting Questions but rather Quiz from Questions.
19 replies
KPCKevin Powell - Community
•Created by Jonah on 10/1/2024 in #front-end
Problem with the container background
You are never passing isQuizCompleted into Main
19 replies
KPCKevin Powell - Community
•Created by Jonah on 10/1/2024 in #front-end
Problem with the container background
I cannot load that link, it says I do not have access.
19 replies
KPCKevin Powell - Community
•Created by Lofty! on 10/1/2024 in #front-end
How do you makes "emoji as a letter" accessible?
@Jochem font-size: 0 works well. Just tested in a code pen
https://codepen.io/caldane/pen/XWvXLob
The nested spans are still necessary to so you don't end up targeting the emoji with the first-letter selector. @Chris solved this by making it position absolute, but then you have to position the emoji (which was possible with right: 100%). This way doesn't require jumping out of the stacking context, which has some value.
The display flex and align-items is to force the text and emoji to have the same lower bounds.
The line height is a bit of a hack but it allows for the emoji to look like it is on the same baseline as the text.
With everyone's suggestion implemented in this version I find it to be a rather elegant solution to an interesting problem.
25 replies
KPCKevin Powell - Community
•Created by Lofty! on 10/1/2024 in #front-end
How do you makes "emoji as a letter" accessible?
I do not disagree but it may be a better use case for attr than a custom property
25 replies
KPCKevin Powell - Community
•Created by Lofty! on 10/1/2024 in #front-end
How do you makes "emoji as a letter" accessible?
Yes with the caveat that nested components (which is super unlikely) would still have --content set.
25 replies
KPCKevin Powell - Community
•Created by Lofty! on 10/1/2024 in #front-end
How do you makes "emoji as a letter" accessible?
You would have to be careful with nested spans and also you do not have a way to "eat" the first character if you put the emoji in the span.
25 replies
KPCKevin Powell - Community
•Created by Lofty! on 10/1/2024 in #front-end
How do you makes "emoji as a letter" accessible?
This is a little fiddley. It is consistent across a single font-family, but if you changed the font-family you would need to change the
ch
value. The advantage of this method would be that a screen reader would read the word properly.
Also if you didn't want the screen reader to read the emoji you could put it in a before element instead.
25 replies
KPCKevin Powell - Community
•Created by Vandana on 8/9/2024 in #front-end
JS Shorthand
This is why I proposed:
102 replies
KPCKevin Powell - Community
•Created by Vandana on 8/9/2024 in #front-end
JS Shorthand
Assignment has to follow
{{varname}} = {{value}}
so you cannot do {{value}} {{operator}} {{varname}} = {{otherValue}}
102 replies
KPCKevin Powell - Community
•Created by Vandana on 8/9/2024 in #front-end
JS Shorthand
no problem, I have seen many people help out on this discord and I believe most people see this as a way to learn and teach. When you are further down your coding journey then it will be your time to teach, but for now just keep trying to learn 🙂
102 replies
KPCKevin Powell - Community
•Created by Vandana on 8/9/2024 in #front-end
JS Shorthand
So in your code sample from above what would this do:
compMove will be set to
false
;
compMove will be set to 'Paper'
;
compMove will be set to false
;
Therefore trampling 'Paper'
102 replies
KPCKevin Powell - Community
•Created by Vandana on 8/9/2024 in #front-end
JS Shorthand
So if that is the case then the following will also never return 'Rock'
102 replies
KPCKevin Powell - Community
•Created by Vandana on 8/9/2024 in #front-end
JS Shorthand
More accurately the following statement when true will return 'Rock'
More simply put:
102 replies
KPCKevin Powell - Community
•Created by Vandana on 8/9/2024 in #front-end
JS Shorthand
There is value in that, pushing a code to its limits has merit in learning. If this were production code, it would be inadvisable, if this is just for learning, and I suspct it is since it is Rock, Paper, Scissors, then this is perfectly fine.
102 replies
KPCKevin Powell - Community
•Created by Vandana on 8/9/2024 in #front-end
JS Shorthand
You do not need to read this you are wasting your own time, don't blame others for your decisions. This is a forum for help, if you have no intention in being helpful your input is not welcome.
102 replies
KPCKevin Powell - Community
•Created by Vandana on 8/9/2024 in #front-end
JS Shorthand
This isn't helpful, many times I have written esoteric code to understand the code better. This could very well be this person path to understanding basic code flow.
102 replies
KPCKevin Powell - Community
•Created by Vandana on 8/9/2024 in #front-end
JS Shorthand
Because the syntax you are using is boolean && string.
The boolean is for shortcutting the rest of the logic, if the first part is
The boolean is for shortcutting the rest of the logic, if the first part is
false
then stop executing logic on the and
as no further values matter. If the value is true
check to see if the next value is true
.
So that means if the first part evaluates to false
the assignment will be false
, it will not even attempt to look at the string.
However if it is true
then further evaluation need to be had.
Non-empty string are true
in js but the do not return the value true
but rather the value of the string.
Therefore those assignment statements must return your string literal or false
102 replies