Skip to content
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

Users can now conditionally reveal content on pages with multiple grouped radios #1497

Merged
merged 8 commits into from
Jul 23, 2019

Commits on Jul 17, 2019

  1. Configuration menu
    Copy the full SHA
    b4a0232 View commit details
    Browse the repository at this point in the history
  2. Fix conditional reveal behaviour with multiple radio groups

    When multiple groups of radios with the same `name` appear on a page, selecting any radio button may cause radio buttons in other groups to become deselected.
    
    However, because we only previously triggered setAttributes on radio buttons within the same $module, the conditional reveals associated with the now-unchecked radios would still be visible.
    
    By triggering setAttributes on all radios in the document, we can avoid this. This should be safe as all we're doing is syncing the visibility of the conditional reveal with its associated input.
    NickColley committed Jul 17, 2019
    Configuration menu
    Copy the full SHA
    db3ac4a View commit details
    Browse the repository at this point in the history
  3. Only handle clicks on radio inputs

    This stops this loop for running unnecessarily, for example for clicks
    in an open conditional reveal.
    NickColley committed Jul 17, 2019
    Configuration menu
    Copy the full SHA
    7858436 View commit details
    Browse the repository at this point in the history
  4. Use querySelector string to filter out inputs

    We did not need the radios check as the querySelector already had
    `[type="radio"]`.
    
    We can also remove the aria-controls check by movin it into the
    querySelector as `[aria-controls]`.
    NickColley committed Jul 17, 2019
    Configuration menu
    Copy the full SHA
    129cd38 View commit details
    Browse the repository at this point in the history
  5. Only set attributes on inputs with same name

    We do not need to run this code for other inputs as their state will not
    have changed.
    NickColley committed Jul 17, 2019
    Configuration menu
    Copy the full SHA
    d296af8 View commit details
    Browse the repository at this point in the history
  6. Only query radios that are within the same form

    By doing this alongside checking the name we only run setAttributes on
    the radio inputs that could change.
    NickColley committed Jul 17, 2019
    Configuration menu
    Copy the full SHA
    60bc3f8 View commit details
    Browse the repository at this point in the history
  7. Check for radio conditionals before setting attrs

    Since sometimes users set aria-controls unrelated to
    conditional reveals we need to be extra careful here.
    
    See #1156 for more
    context.
    NickColley committed Jul 17, 2019
    Configuration menu
    Copy the full SHA
    9eb6465 View commit details
    Browse the repository at this point in the history
  8. Update CHANGELOG entry

    NickColley committed Jul 17, 2019
    Configuration menu
    Copy the full SHA
    8665fa5 View commit details
    Browse the repository at this point in the history