Conversation
|
@drgrice1 One thing I was unsure about was parserPopUp when the |
c9c5189 to
f0b699a
Compare
a89d1b7 to
42c7f4a
Compare
|
I added @Alex-Jordan suggestion, PGML can now use I made this its own commit to easily remove. |
1f2d1eb to
e36d6e4
Compare
That doesn't even make sense and wouldn't work. If the visually hidden span wrapped the popup menu, then the popup menu would also be visually hidden. |
|
Right, if the span did wrap the drop down, it shouldn't be visually hidden. I was just confused because the label is just by itself, |
|
There was some discussion on that in #1159. It was about getting the screen reader to announce the right thing when the dropdown menu is open. |
218074f to
b279f53
Compare
Update the `generate_aria_label` method to be given an input label.
If the input label is defined and doesn't contain `%s`, return
the label. If the input label is undefined (or blank) generate
a default label based on the problem number, answer number, and
part number. If the input label contains `%s`, replace it with
the default generated label and return the result.
Update answer rules to more uniformly accept the `aria_label`
option and use the `generate_aria_label` method. This required
updating some and adding the option to others.
Update macros that use the `generate_aria_label` method to take
advantage of the new method. The parserRadioButtons and
parserCheckboxList will append "option X" to the end of the
generated label. Matrix arrays will append "col N row M" to
the end of the generated label.
Update PGML to accept the `aria_label` option in answer blanks
to customize the label, "[_]{$answer}{aria_label => '%s label'}".
The biggest change was in parserRadioMultiAnswer which allows
a new option `ariaLabels` which is the labels to send to the
associated answer rules. Update its internal `generate_aria_label`
function to match the changes to the one in PGbasicmacros. In
addition the "subpart X" is only added to the label if there are
more than one subparts, and the "part Y" will use the label of
the part if `displayLabels` is set, otherwise it uses the number
of the part.
| foreach my $i (0 .. $#choices) { | ||
| my $value = $self->{values}[$i]; | ||
| my $tag = $choices[$i]; | ||
| my $label = main::generate_aria_label($name, delete $options{aria_label}); |
There was a problem hiding this comment.
This is adding aria labels back to parserRadioButtons.pl answers. These were just removed a release or two ago. That is because these should not have an aria label when they already have an actual visible label. See #1224.
There was a problem hiding this comment.
Ahh, I should have looked deeper as to why these were not present. It did feel odd they were not there, and I now see that in parserRaidoMultianswer, the aria labels are added to the additional inputs but not the actual radio select buttons.
Would it be worth adding a label to the radio-buttons-container or checkbox-container so there could be a label for the whole radio/checkbox select stating either what problem it is or allowing users to label?
There was a problem hiding this comment.
The problem author sets the text which is the label. I think that the author can also always add a statement before the radio or check container that is for everyone to see. So I would say not to an aria label on those.
There was a problem hiding this comment.
Okay removed that here and the other place you noted that was incorrect. Though there is still a small change with the code cleanups I did. I can remove those changes if you prefer.
I also noticed that NAMED_ANS_RADIO_BUTTONS was still using aria_label, but then passed it to a method that didn't use them, so I cleaned up that method to also no longer have that unneeded logic.
| name => $name, | ||
| id => $name, | ||
| value => $value, | ||
| aria_label => generate_aria_label($name, $options{aria_label}), |
There was a problem hiding this comment.
This also was removed in #1224, and should not be added back. The same for line 492 below.
This adds being able to parse the aria label from the PGML answer blank directly using `[_aria label_]`.
Update the
generate_aria_labelmethod to be given an input label. If the input label is defined and doesn't contain%s, return the label. If the input label is undefined (or blank) generate a default label based on the problem number, answer number, and part number. If the input label contains%s, replace it with the default generated label and return the result.Update answer rules to more uniformly accept the
aria_labeloption and use thegenerate_aria_labelmethod. This required updating some and adding the option to others.Update macros that use the
generate_aria_labelmethod to take advantage of the new method. The parserRadioButtons and parserCheckboxList will append "option X" to the end of the generated label. Matrix arrays will append "col N row M" to the end of the generated label.Update PGML to accept the
aria_labeloption in answer blanks to customize the label, "[_]{$answer}{aria_label => '%s label'}".The biggest change was in parserRadioMultiAnswer which allows a new option
ariaLabelswhich is the labels to send to the associated answer rules. Update its internalgenerate_aria_labelfunction to match the changes to the one in PGbasicmacros. In addition the "subpart X" is only added to the label if there are more than one subparts, and the "part Y" will use the label of the part ifdisplayLabelsis set, otherwise it uses the number of the part.This is a more general approach and replacement of #1489. Due to the discussion I am calling the option
aria_labelto match what was already in the code,labelis not a correct name, andaccessibility_labelis just longer and would require making the code better deal with that.aria_labelwas already in use and is now just being used more uniformly.aria_labelcan be used in PGML or sent directly to variousans_ruleorans_arraycalls.I went with @dpvc suggestion of allowing a single
%ssprintf option to include the default generated label as part of the custom label. To not get any errors fromsprintf, I went with just regex find/replace of the first instance of%sin the string.Here is a problem I was using to test various different checkers and macros. Edit it to remove the
aria_labeloption to check out default generated labels or remove%sto see any effects.