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

Add cookie banner component and button groups #2131

Merged
merged 41 commits into from
Feb 8, 2021
Merged

Commits on Jan 26, 2021

  1. Add button groups objects

    Add a new button groups object which can be used to group buttons and
    links together.
    
    Within a button group:
     - links are styled to line up visually with the buttons, including
       being centre-aligned on mobile
     - spacing between the buttons and links is handled automatically,
       including when they wrap across multiple lines
    
    The button group object will then be used to group the 'Accept cookies',
    'Reject cookies' and 'View and set cookie preferences' buttons and links
    in the cookie banner component.
    
    The button group object uses flexbox and align-items to align the
    buttons and links along the 'cross axis' – centre-aligning on mobile and
    aligning rows along the baseline on tablet and above.
    
    align-items is in theory supported in IE11 and above, but our use of
    autoprefixer means that IE10-compatible flexbox properties are also
    included, and in testing it works as well in IE10 as it does in IE11.
    
    In browsers that do not support flexbox [1] or align-items [2] the
    spacing between buttons and links is different (as whitespace between
    inline blocks is not handled) and they are not aligned along the
    cross-axis, but the general layout is still applied.
    
    [1]: https://caniuse.com/flexbox
    [2]: https://caniuse.com/mdn-css_properties_align-items_flex_context
    36degrees committed Jan 26, 2021
    Configuration menu
    Copy the full SHA
    4c17b6d View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    e5f50d7 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    b650d2d View commit details
    Browse the repository at this point in the history

Commits on Jan 27, 2021

  1. Merge pull request #2114 from alphagov/cookie-banner-button-groups

    Add button groups for use in cookie banner
    36degrees authored Jan 27, 2021
    Configuration menu
    Copy the full SHA
    fd2c60e View commit details
    Browse the repository at this point in the history
  2. Remove redundant align-button modifiers in example

    The original intent was to use a modifier on links to align them with buttons, but we ended up finding another approach that used flexbox and didn’t require the modifier. However, the classes were never removed from the example page in the review app.
    
    Remove the redundant classes as they are not doing anything and will only cause confusion.
    36degrees committed Jan 27, 2021
    Configuration menu
    Copy the full SHA
    6d53d09 View commit details
    Browse the repository at this point in the history
  3. Merge pull request #2124 from alphagov/remove-accidental-classes

    Remove redundant align-button modifiers in example
    36degrees authored Jan 27, 2021
    Configuration menu
    Copy the full SHA
    5fc8ee6 View commit details
    Browse the repository at this point in the history

Commits on Jan 28, 2021

  1. Add draft macro options

    Vanita Barrett committed Jan 28, 2021
    Configuration menu
    Copy the full SHA
    8ffeb08 View commit details
    Browse the repository at this point in the history
  2. Add HTML for cookie banner component macro

    Vanita Barrett committed Jan 28, 2021
    Configuration menu
    Copy the full SHA
    8f2fe2e View commit details
    Browse the repository at this point in the history
  3. Add YAML examples for cookie banner

    Vanita Barrett committed Jan 28, 2021
    Configuration menu
    Copy the full SHA
    857e9f7 View commit details
    Browse the repository at this point in the history
  4. Add skeleton CSS files for cookie banner

    Vanita Barrett committed Jan 28, 2021
    Configuration menu
    Copy the full SHA
    b26f2a9 View commit details
    Browse the repository at this point in the history
  5. Add tests for cookie banner

    Vanita Barrett committed Jan 28, 2021
    Configuration menu
    Copy the full SHA
    834be0a View commit details
    Browse the repository at this point in the history
  6. Use HTML hidden attribute for hiding banners

    Vanita Barrett committed Jan 28, 2021
    Configuration menu
    Copy the full SHA
    9f2b146 View commit details
    Browse the repository at this point in the history
  7. Import cookie banner CSS

    Vanita Barrett committed Jan 28, 2021
    Configuration menu
    Copy the full SHA
    29c62c5 View commit details
    Browse the repository at this point in the history
  8. Fixes

    Vanita Barrett committed Jan 28, 2021
    Configuration menu
    Copy the full SHA
    8d2ea35 View commit details
    Browse the repository at this point in the history
  9. Whitespace fixes

    Vanita Barrett committed Jan 28, 2021
    Configuration menu
    Copy the full SHA
    4de49d9 View commit details
    Browse the repository at this point in the history
  10. Rename container class to message class

    Vanita Barrett committed Jan 28, 2021
    Configuration menu
    Copy the full SHA
    f4c2304 View commit details
    Browse the repository at this point in the history
  11. Update to final macro content

    Vanita Barrett committed Jan 28, 2021
    Configuration menu
    Copy the full SHA
    f624213 View commit details
    Browse the repository at this point in the history
  12. Reword role test name

    To make it clear that role region cannot be overridden or removed
    
    Co-authored-by: Oliver Byford <[email protected]>
    Vanita Barrett and 36degrees authored Jan 28, 2021
    Configuration menu
    Copy the full SHA
    edd1883 View commit details
    Browse the repository at this point in the history
  13. Merge pull request #2119 from alphagov/cookie-banner-macro

    Add Nunjucks macro template, tests and examples for cookie banner
    Vanita Barrett authored Jan 28, 2021
    Configuration menu
    Copy the full SHA
    649cfb8 View commit details
    Browse the repository at this point in the history
  14. Add an example of a server-side cookie banner

    The cookie banner components needs to be flexible enough to work for both server-side and client-side implementations.
    
    Add an example of a typical server-side cookie banner, where a page navigation occurs when the user chooses to accept or reject the cookies, and the choice to render either the original ‘accept/reject’ banner or the confirmation banner is made on the server.
    
    We do include a small amount of client-side JavaScript to handle the ‘Hide’ button in the example, as I think this would typically be handled client-side as nothing needs to be recorded.
    36degrees committed Jan 28, 2021
    Configuration menu
    Copy the full SHA
    2e57418 View commit details
    Browse the repository at this point in the history
  15. Configuration menu
    Copy the full SHA
    5acfef6 View commit details
    Browse the repository at this point in the history
  16. Configuration menu
    Copy the full SHA
    0e549a5 View commit details
    Browse the repository at this point in the history
  17. Configuration menu
    Copy the full SHA
    82e51e2 View commit details
    Browse the repository at this point in the history
  18. Merge pull request #2125 from alphagov/cookie-banner-full-page-examples

    Add full page examples of cookie banners
    36degrees authored Jan 28, 2021
    Configuration menu
    Copy the full SHA
    ed86842 View commit details
    Browse the repository at this point in the history

Commits on Feb 1, 2021

  1. Add additional hidden option for parent container

    Vanita Barrett committed Feb 1, 2021
    Configuration menu
    Copy the full SHA
    f76cc4a View commit details
    Browse the repository at this point in the history
  2. Allow classes and attributes to be passed to cookie banner

    Vanita Barrett committed Feb 1, 2021
    Configuration menu
    Copy the full SHA
    6cef872 View commit details
    Browse the repository at this point in the history
  3. Update full page example

    Vanita Barrett committed Feb 1, 2021
    Configuration menu
    Copy the full SHA
    46febc7 View commit details
    Browse the repository at this point in the history
  4. Merge pull request #2130 from alphagov/add-parent-hidden

    Allow the whole cookie banner component to be hidden
    Vanita Barrett authored Feb 1, 2021
    Configuration menu
    Copy the full SHA
    0136450 View commit details
    Browse the repository at this point in the history

Commits on Feb 2, 2021

  1. Rename banners to messages

    Vanita Barrett committed Feb 2, 2021
    Configuration menu
    Copy the full SHA
    ca6f92d View commit details
    Browse the repository at this point in the history
  2. Refer to cookie messages

    Vanita Barrett committed Feb 2, 2021
    Configuration menu
    Copy the full SHA
    0657fae View commit details
    Browse the repository at this point in the history
  3. Make use of cookie message, message and question message consistent

    We refer to 'question message' as 'cookie message' in the guidance. This commit tweaks the macro options to reflect that.
    Vanita Barrett committed Feb 2, 2021
    Configuration menu
    Copy the full SHA
    f72a571 View commit details
    Browse the repository at this point in the history
  4. Move actions section to match approved macro docs

    Vanita Barrett committed Feb 2, 2021
    Configuration menu
    Copy the full SHA
    44e5421 View commit details
    Browse the repository at this point in the history
  5. Merge pull request #2129 from alphagov/rename-banners-messages

    Rename banners to messages
    Vanita Barrett authored Feb 2, 2021
    Configuration menu
    Copy the full SHA
    497b594 View commit details
    Browse the repository at this point in the history
  6. Add cookie banner styling

    The component does not set bottom spacing. The bottom spacing should be created by the
    items inside the component.
    
     We're going to use the `hidden` attribute to hide sections as this will hide the content even if CSS fails to load.
    
    `display: none;` will act as a fallback for legacy browsers (IE 8-10) that don't support the `hidden` attribute.
    Unfortunately it looks like Lynx doesn't support `hidden` but that's a vendor implementation issue. It also appears that
    Lynx hasn't been in active development for some time. Using the `hidden` attribute seems like the semantically correct
    thing to do here and it makes the component usable when CSS fails to load.
    
    (The alternative would be to insert text into the DOM at relevant points which could also be a suitable solution in some
    contexts. We decided against it as the Design System components need to be really flexible so we're trying to avoid
    patterns where HTML markup needs to be maintained inside JavaScript which will also simplify localisation etc. where
    relevant.)
    
    Visually separate the cookie banner from content underneath with a transparent bottom border
    when user changes colours in their browser.
    hannalaakso committed Feb 2, 2021
    Configuration menu
    Copy the full SHA
    40a1b45 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    d1f8057 View commit details
    Browse the repository at this point in the history
  8. Remove visible focus indicator from cookie banner

    when the element is programmatically focused.
    
    The focused cookie banner is the first element on the page and the last thing the user
    interacted with prior to it gaining focus.
    We therefore assume that moving focus to it is not going to surprise users, and that giving
    it a visible focus indicator could be more confusing than helpful, especially as the
    element is not normally keyboard operable.
    
    We have flagged this in the research section of the guidance as something to monitor.
    
    A related discussion: w3c/wcag#1001
    
    It's also worth noting that this is different to what we do with the notification banner which does have
    a visible focus indicator. However, the notification banner is further down the page and the user might not have interacted with it prior to it gaining focus so it is helpful to indicate to users that the focus has moved to it (even though the element, like the cookie banner, isn’t normally keyboard operable).
    hannalaakso committed Feb 2, 2021
    Configuration menu
    Copy the full SHA
    f77c2f6 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    a57f2b2 View commit details
    Browse the repository at this point in the history

Commits on Feb 5, 2021

  1. Tweaks to macro option documentation

    - Remove duplicated ‘required’ on `messages` and `actions.text` – ‘Required’ is automatically added as a prefix to the description in the Design System when `required` is `true`, so it does not need to be included in the description as well.
    - Mark `messages.text`, `messages.html` as required and remove ‘Required’ from their descriptions
    - Mark `false` as inline code in desecription for `hidden` and `messages.hidden`
    36degrees committed Feb 5, 2021
    Configuration menu
    Copy the full SHA
    8607945 View commit details
    Browse the repository at this point in the history
  2. Tweak description for top-level hidden option

    Co-authored-by: Eoin Shaughnessy <[email protected]>
    36degrees and EoinShaughnessy committed Feb 5, 2021
    Configuration menu
    Copy the full SHA
    8529a49 View commit details
    Browse the repository at this point in the history
  3. Tweak description for hidden param after 2i

    Co-authored-by: EoinShaughnessy <[email protected]>
    36degrees and EoinShaughnessy authored Feb 5, 2021
    Configuration menu
    Copy the full SHA
    153cec9 View commit details
    Browse the repository at this point in the history
  4. Merge pull request #2136 from alphagov/tweaks-to-macro-options

    Tweaks to macro option documentation
    Vanita Barrett authored Feb 5, 2021
    Configuration menu
    Copy the full SHA
    8ba3e2b View commit details
    Browse the repository at this point in the history