Skip to content
This repository has been archived by the owner on Feb 12, 2022. It is now read-only.

Ch1972 add accessibility check for checkbox and radio #1996

Conversation

cmcculloh-kr
Copy link

@cmcculloh-kr cmcculloh-kr commented Jun 21, 2017

Fixes #1972

Adds a console error message if visibility: hidden or visibility: collapse is applied to the checkbox.

Cleans up checkbox unit tests and makes UMD wrapper more consistent across all core fuel ux files.

If you are getting the following error:
For accessibility reasons, in order for tab and space to function on [checkbox|radio], visibilitymust not be set tohiddenorcollapse. See https://github.com/ExactTarget/fuelux/pull/1996 for more details.

It means that your code (probably in the CSS) is inappropriately setting the checkbox or radio visibility to hidden or collapse. You can fix it by:

  1. (Preferred) Update to the most recent version of Lightning Theme or MC Theme.
  2. (Allowed) If you are unable to upgrade to the latest Lightning or MC Themes, or if you are using some other custom CSS or theme that sets this, find the place where your code is doing this and don't do it instead.
    • For Lightning Theme, that means editing [file] line [number] to be [thing]
    • For MC Theme, that means editing [file] line [number] to be [thing]
  3. If you have a valid reason for making the checkbox or radio hidden (ie, if it is hidden on pageload and you plan to show it later) try making the parent container hidden instead, or else setting display to none on pageload. Or (worst-case) add a data attribute data-ignore-visibility-check=true or pass an option on init $yourCheckbox.checkbox({ignoreVisibilityCheck: true}) to make checkbox ignore the error.

Christopher McCulloh added 20 commits June 15, 2017 15:10
…unctional programming pattern (actually uses passed in var)
@cmcculloh-kr cmcculloh-kr changed the title Ch1972 add accessibility check for checkbox Ch1972 add accessibility check for checkbox and radio Jun 21, 2017
@cmcculloh-kr cmcculloh-kr added this to the 3.16.1 milestone Jun 21, 2017
Christopher McCulloh added 2 commits June 21, 2017 16:26
…of checkbox tests and weren't actually even running in some instances somehow
@interactivellama
Copy link
Contributor

I really like this proactive check. You might consider some kind of production/dev env check, but I think you can only do that in CommonJS not ES5.

index.js Outdated
if (window.console && window.console.clear) {
window.console.clear();
}
// if (window.console && window.console.clear) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just remove it, if you don't want it.

Christopher McCulloh added 3 commits June 27, 2017 17:25
…b.com:cormacmccarthy/fuelux into CH1972---add-accessibility-check-for-checkbox
js/scheduler.js Outdated
// -- END UMD WRAPPER PREFACE --

// -- BEGIN MODULE CODE HERE --
if (!$.fn.combobox || !$.fn.datepicker || !$.fn.radio || !$.fn.selectlist || !$.fn.spinbox) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think any of these namespace checks should be in the bundled code, since the code is known to be there. You've moved it into the bundled library in multiple place.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I literally just moved it down below the UMD wrapper comment... Are you saying that somehow changed the way it gets bundled?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm saying that if you move it into the -- BEGIN MODULE CODE HERE -- part then it WILL get into the bundle, instead of just used when you require the one control.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wait, so you're telling me that the bundle gets generated in part based on a comment in the code?

Copy link
Contributor

@interactivellama interactivellama Jun 27, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the bundle is created with concat. We couldn't do require or ES6 import, etc.

https://github.com/ExactTarget/fuelux/blob/master/grunt/config/concat.js#L32

require('./checkbox-tests/return')(QUnit);
require('./checkbox-tests/get-value')(QUnit);
require('./checkbox-tests/events')(QUnit);
require('./checkbox-tests/visibility')(QUnit);
Copy link
Contributor

@interactivellama interactivellama Jun 27, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if we are skipping the visibility tests, then should we comment this line out so no one sees it.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, the point of making it .skip is that you alert the person that "there's a thing that maybe ought to be tested, but actually isn't". That way they can either add the test, or go test it themselves. If we comment it out, we might as well just remove it... Any thoughts @futuremint (Dave is the one who told me to add the skip tests)?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about something like "skipped intentionally, future work" added to the test name.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking closer at this, checkbox visibility tests are fully defined. Not sure where you are seeing it is skipped? Tree is the only thing that has skipped tests (and those were added by a different PR).

@interactivellama
Copy link
Contributor

interactivellama commented Jun 27, 2017

index.html should be an example of how to use Fuel UX, not a testing location for console errors. Please move these to another page if in browser testing is the purpose.

Another option is to label the "bad checkboxes" as "THIS MARKUP IS WRONG" or something.

@interactivellama
Copy link
Contributor

Please remove skipped tests or add something obvious to tell new folks to the project why they are skipped. Could be in test name?

screen shot 2017-06-27 at 3 36 39 pm

Christopher McCulloh added 2 commits June 27, 2017 18:57
@cmcculloh-kr
Copy link
Author

The skipped tests were added in a different PR, but I've documented them in this PR a little in response to your request for them to be removed. In #2000 I fleshed a few of them out more.

It's important for them to be there as an indicator that there is functionality that isn't actually being tested (that in a perfect world would be). That way, if the PR or change someone is working on has anything to do with those things (this PR doesn't...), they'll know that those things need tested more carefully manually by both the dev and the reviewer(s) and/or those tests need fleshed out.

@cmcculloh-kr
Copy link
Author

Oops! I always forget that index.html is anything other than just a place to do testing. Will fix, thanks.

@interactivellama interactivellama merged commit bb6c760 into ExactTarget:master Jun 28, 2017
@cmcculloh-kr cmcculloh-kr deleted the CH1972---add-accessibility-check-for-checkbox branch July 12, 2017 17:59
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Checkbox and Radio should be accessible
3 participants