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

Create password input component #4442

Merged
merged 46 commits into from
Mar 15, 2024
Merged

Commits on Mar 12, 2024

  1. Prototype password input component

    This is a (mostly) straight port of the JavaScript in GOV.UK Publishing Components combined with the text input component, with some minor
    alterations:
    
    - JavaScript has been modified to fit the Design System's coding and documentation conventions.
    - Support for configuration and localisation strings has been added.
    - The function to move specific data-attributes has been omitted for the time being.
    - Custom button styles have not been ported, instead using those from the Design System.
    - Configuration options (via JS or data-attributes) haven't been hooked up just yet.
    querkmachine committed Mar 12, 2024
    Configuration menu
    Copy the full SHA
    35225f1 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    ef6b1cf View commit details
    Browse the repository at this point in the history
  3. Style refinements

    - Fix button appearing visually taller than the input
    - Fix button changing size when text updated by setting a sensible flex-basis
    - Fix button obscuring the input's focus style by adding a small space between the elements
    querkmachine committed Mar 12, 2024
    Configuration menu
    Copy the full SHA
    ea53ddd View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    33a48cb View commit details
    Browse the repository at this point in the history
  5. Hide user agent password reveal function in Microsoft Edge

    Microsoft Edge provides its own mechanism for users to show and hide their password in the form of an eye icon within the input. (The feature is built into Chromium itself, however only Edge appears to use it for inputs on the web. Google Chrome only appears to use it in browser dialogs and in the settings area of the browser.)
    
    We don't want to show this to our users. The button visually reproduces the functionality of our toggle, but in a way that we cannot syncronise with, thus it's possible for the two controls to present labelling that conflicts with the actual visibility of the password.
    
    We can use a vendor-prefixed pseudo-element to hide the button in Edge, but this doesn't disable other functionality that is specific to Edge's implementation, like the Alt+F8 keyboard shortcut.
    querkmachine committed Mar 12, 2024
    Configuration menu
    Copy the full SHA
    38f8834 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    14a1b4a View commit details
    Browse the repository at this point in the history
  7. Reset component state on pageshow event

    If a user filled out a password input and then navigated away from the page via a link, it is possible to use the browser back button to return to the page with the password field populated. It could then be viewed and copied using the show button. This could potentially be used by bad actors to obtain user passwords.
    
    This code now blanks the input and resets the component state if the page is returned to, unless an explicit value has been set by the developer.
    
    Athough we cannot guarantee complete safety in this scenario (as the attacker evidently has obtained some level of physical or remote access already), it may make this attack vector slightly more difficult to accomplish.
    querkmachine committed Mar 12, 2024
    Configuration menu
    Copy the full SHA
    335926a View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    0f77224 View commit details
    Browse the repository at this point in the history
  9. Minor attribute fixes

    - `spellcheck` was being set as a string despite govukInput expecting it as a boolean.
    - `autocapitalize` used the value 'off'. This appears to be a legacy value from the days it was specific to iOS, with 'none' being the newer, standardised value.
    querkmachine committed Mar 12, 2024
    Configuration menu
    Copy the full SHA
    1f9d107 View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    dc89d72 View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    8524793 View commit details
    Browse the repository at this point in the history
  12. Configuration menu
    Copy the full SHA
    436a555 View commit details
    Browse the repository at this point in the history
  13. Configuration menu
    Copy the full SHA
    85f7e76 View commit details
    Browse the repository at this point in the history
  14. Configuration menu
    Copy the full SHA
    e9c64cf View commit details
    Browse the repository at this point in the history
  15. Configuration menu
    Copy the full SHA
    da49337 View commit details
    Browse the repository at this point in the history
  16. Configuration menu
    Copy the full SHA
    5915a66 View commit details
    Browse the repository at this point in the history
  17. Configuration menu
    Copy the full SHA
    2a056a4 View commit details
    Browse the repository at this point in the history
  18. Assume Password input $module might be null

    Possible return value from `document.querySelector()`
    colinrotherham authored and querkmachine committed Mar 12, 2024
    Configuration menu
    Copy the full SHA
    028a282 View commit details
    Browse the repository at this point in the history
  19. Configuration menu
    Copy the full SHA
    7a47001 View commit details
    Browse the repository at this point in the history
  20. Add missing param description

    colinrotherham authored and querkmachine committed Mar 12, 2024
    Configuration menu
    Copy the full SHA
    022b000 View commit details
    Browse the repository at this point in the history
  21. Configuration menu
    Copy the full SHA
    b223bfd View commit details
    Browse the repository at this point in the history
  22. Configuration menu
    Copy the full SHA
    800447d View commit details
    Browse the repository at this point in the history
  23. Consolidate setup code

    Helps JavaScript minifiers crunch this down more
    colinrotherham authored and querkmachine committed Mar 12, 2024
    Configuration menu
    Copy the full SHA
    e858b43 View commit details
    Browse the repository at this point in the history
  24. Configuration menu
    Copy the full SHA
    baf4927 View commit details
    Browse the repository at this point in the history
  25. Hide the password if the page is restored from cache

    If the user navigates back to the page through some means (back/forward buttons, reopening recently closed tab, etc.), re-hide the password if it's currently visible.
    querkmachine committed Mar 12, 2024
    Configuration menu
    Copy the full SHA
    3e9792f View commit details
    Browse the repository at this point in the history
  26. Remove disableFormSubmitCheck option

    Discussions with the contributor previously revealed that this was added defensively 'just in case'. As far as we are aware it hasn't actually been used anywhere (both via anecdotal evidence and the only GitHub search results being spec tests), indicating it has little to no actual user need or demand.
    
    In the interests of keeping things simple, we're going to remove this from our initial version.
    querkmachine committed Mar 12, 2024
    Configuration menu
    Copy the full SHA
    f28aa29 View commit details
    Browse the repository at this point in the history
  27. Configuration menu
    Copy the full SHA
    b48f702 View commit details
    Browse the repository at this point in the history
  28. Configuration menu
    Copy the full SHA
    77f00c3 View commit details
    Browse the repository at this point in the history
  29. Add "sign in" full-page example to review app

    This example allows us to test the password input in the context of signing into an existing account. This is in contrast to "update your account details", which requests a new password instead of asking for the current one.
    querkmachine committed Mar 12, 2024
    Configuration menu
    Copy the full SHA
    d0f5c45 View commit details
    Browse the repository at this point in the history
  30. Fix incorrect translation key being created

    The code for setting the aria-label was generating the keys `showAriaLabel` and `hideAriaLabel`. The keys are actually `showPasswordAriaLabel` and `hidePasswordAriaLabel` respectively.
    querkmachine committed Mar 12, 2024
    Configuration menu
    Copy the full SHA
    9b716c5 View commit details
    Browse the repository at this point in the history
  31. Configuration menu
    Copy the full SHA
    ca304eb View commit details
    Browse the repository at this point in the history
  32. Make status announcement assertive

    Changes the aria-live attribute of the hidden status element from "polite" to "assertive".
    
    This is intended to rectify an issue with VoiceOver on macOS, where the announcement would be spoken over by the changing text and aria-label of the toggle button. In this case, notifying the user that their password is visible (or not) feels like an important piece of information that should take priority.
    querkmachine committed Mar 12, 2024
    Configuration menu
    Copy the full SHA
    c902abc View commit details
    Browse the repository at this point in the history
  33. Configuration menu
    Copy the full SHA
    fb86ccb View commit details
    Browse the repository at this point in the history
  34. Configuration menu
    Copy the full SHA
    d3d2215 View commit details
    Browse the repository at this point in the history
  35. Configuration menu
    Copy the full SHA
    5aca96f View commit details
    Browse the repository at this point in the history
  36. Change toEqual -> toBe

    Align with the style changes in #4843.
    querkmachine committed Mar 12, 2024
    Configuration menu
    Copy the full SHA
    b1cfb89 View commit details
    Browse the repository at this point in the history

Commits on Mar 14, 2024

  1. Configuration menu
    Copy the full SHA
    770a13c View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    8f349d7 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    bf8d6c8 View commit details
    Browse the repository at this point in the history
  4. Condense multiple toggle tests together

    Co-authored-by: Romaric Pascal <romaric.pascal@digital.cabinet-office.gov.uk>
    querkmachine and romaricpascal committed Mar 14, 2024
    Configuration menu
    Copy the full SHA
    6601ebe View commit details
    Browse the repository at this point in the history
  5. Set aria-live on component initialisation

    Testing a hypothesis that VoiceOver failing to read the aria-live consistently may be due to it only being added when a status is set for the first time.
    
    If this is the case, then potentially it's also unnecessary to use assertive over polite.
    querkmachine committed Mar 14, 2024
    Configuration menu
    Copy the full SHA
    80d33b4 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    5ee9365 View commit details
    Browse the repository at this point in the history

Commits on Mar 15, 2024

  1. Configuration menu
    Copy the full SHA
    5cd0c05 View commit details
    Browse the repository at this point in the history
  2. Merge pull request #4763 from alphagov/show-hide-password-component-p…

    …uppeteer-tests
    
    Add Puppeteer tests for Password input
    querkmachine committed Mar 15, 2024
    Configuration menu
    Copy the full SHA
    812387f View commit details
    Browse the repository at this point in the history
  3. Reorder tests

    querkmachine committed Mar 15, 2024
    Configuration menu
    Copy the full SHA
    07d5621 View commit details
    Browse the repository at this point in the history
  4. Add changelog entry

    querkmachine committed Mar 15, 2024
    Configuration menu
    Copy the full SHA
    2b5d976 View commit details
    Browse the repository at this point in the history