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 summary list component #1065

Merged
merged 5 commits into from
Jan 9, 2019
Merged

Add summary list component #1065

merged 5 commits into from
Jan 9, 2019

Conversation

dashouse
Copy link

@dashouse dashouse commented Nov 19, 2018

This component was initially developed to allow us to build the
'check your answers' pattern.

It is mostly the same as in the original pattern with some notable differences:

  • On smaller screens it wraps by default
  • It's possible to have multiple actions

Review

Todo

  • Consider visuallyHiddenText feature instead of using html
  • Improve the options descriptions
  • Assistive technology final run through

https://trello.com/c/kh2atSrd/1612-add-summary-list-component-to-govuk-frontend-pair

@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-review-pr-1065 November 19, 2018 09:41 Inactive
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-review-pr-1065 November 22, 2018 13:43 Inactive
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-review-pr-1065 November 22, 2018 16:10 Inactive
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-review-pr-1065 November 22, 2018 16:11 Inactive
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-review-pr-1065 November 22, 2018 18:00 Inactive
@NickColley
Copy link
Contributor

NickColley commented Nov 22, 2018

I'm wondering if we should rename the classes to something like

.govuk-summary-list__key {}
.govuk-summary-list__value {}
.govuk-summary-list__actions {}

@dashouse can we only include modifiers that we know are needed for check your answers?
Reducing the API surface is good if possible, but if you think some of these modifiers are definitely going to be used I won't block that.

Additionally, can we just always do the break wrap behaviour? I'm worried that in the real world it's not realistic for people to conditionally apply classes based on content.

This would also mean users of zoom text, would always have the actions on the left.

@dashouse
Copy link
Author

I think there was some desire to get away from the "key value pairs" name, I'm not sure if that extends to class names too but I'm not precious about any of it.

Regarding the wrapping as default, let me talk to Joe as I think he designed it originally. The only reason I didn't do this was that the current pattern doesn't.

The modifiers were there to make it meet the needs for more than 'Check answers', although I'm not sure we need the text align one as that would be an easy modification to make for someone / could be a universal override.

p.s. Looking good, I think a few of the CSS changes you've made have changed the spacing a little. We can go through this when we're in the same room if that's easier.

@joelanman
Copy link
Contributor

Just to note datalist is an existing html element so we might not want to reuse the name:

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/datalist

@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-review-pr-1065 November 23, 2018 11:14 Inactive
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-review-pr-1065 November 26, 2018 10:45 Inactive
@fofr
Copy link
Contributor

fofr commented Nov 26, 2018

Current screenshot for interested onlookers:
screen shot 2018-11-26 at 12 13 11

https://govuk-frontend-review-pr-1065.herokuapp.com/components/data-list

@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-review-pr-1065 November 26, 2018 13:31 Inactive
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-review-pr-1065 November 26, 2018 13:51 Inactive
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-review-pr-1065 November 26, 2018 14:06 Inactive
@NickColley
Copy link
Contributor

NickColley commented Nov 27, 2018

I went through the API proposal with the development team and we agreed with the current approach.

API proposals discussed

Classes functionality, now:

{{ govukDataList({
  "keyClasses": "govuk-!-width-one-half",
  "valueClasses": "govuk-!-width-one-quarter",
  "actionsClasses": "govuk-!-width-one-half",
  "rows": [
    {
      "key": "Name",
      "text": "Firstname Lastname",
      "actions": [
        {
          "href": "#",
          "text": "Edit"
        },
        {
          "href": "#",
          "text": "Delete"
        }
      ]
    }
  ]
}) }}

Alternatives:

{{ govukDataList({
  "rows": [
    {
      "key": {
        classes: 'key-class',
        text: "Name"
      },
      "value": {
        classes: 'value-class',
        "text": "Sarah Philips"
      },
      "actions": {
        classes: 'actions-class',
        items: [
          {
            "href": "#",
            "text": "Change"
          }
        ]
      }
      ]
    }
  ]
}) }}

or maybe

{{ govukDataList({
  "rows": [
    {
      "keyClasses": "govuk-!-width-one-half",
      "key": "Name",
      "classes": "govuk-!-width-one-quarter",
      "text": "Firstname Lastname",
      "actionsClasses": "govuk-!-width-one-half",
      "actions": [
        {
          "href": "#",
          "text": "Edit"
        },
        {
          "href": "#",
          "text": "Delete"
        }
      ]
    }
  ]
}) }}

I think by nesting it's more verbose but allows us to allow for text/html consistently too?

@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-review-pr-1065 November 27, 2018 14:05 Inactive
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-review-pr-1065 November 27, 2018 17:01 Inactive
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-review-pr-1065 November 27, 2018 18:05 Inactive
@dashouse dashouse changed the title WIP - Data list component WIP - Data summary list component Dec 10, 2018
@NickColley NickColley force-pushed the data-list-component branch 4 times, most recently from 8adbdd6 to a817b3c Compare December 14, 2018 17:26
@NickColley NickColley changed the title WIP - Data summary list component Add data summary list component Dec 14, 2018
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-review-pr-1065 December 14, 2018 17:56 Inactive
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-review-pr-1065 December 17, 2018 15:53 Inactive
@NickColley
Copy link
Contributor

NickColley commented Dec 18, 2018

Tested in assistive technologies and they're all consistent with the Prototype Kit but I wonder if we do want this behaviour...

VoiceOver OSX:

Links read "name Change" when I expected "Change name", this might be consistent with #1096

NVDA 2018: "Change name"
JAWS 17: "Change name"

On iPhone this is worse since it doesnt read out the visually hidden text at all...

@NickColley
Copy link
Contributor

Without more investigation and thinking I'm not sure I can make a decision on if this should ship as is, it is consistent with the GOV.UK Prototype Kit implementation.

Ideally I think we should talk to the accessibility team and try to come up with how we might resolve the general issue of our govuk-visually-hidden class (#1096).

I don't believe there's any hard deadline for this component, so it could wait until we've figured out the best way to proceed.

Alternatively we could change how this component works to use ARIA, by replacing 'visuallyHiddenText' with 'accessibleName' as follows:

{
  text: 'Change',
  accessibleName: 'Change name'  // see https://www.w3.org/TR/accname-1.1/
}
<a href="#" aria-label="Change name">Change</a>

@dashouse
Copy link
Author

It looks like somewhere in the code refactoring we’ve lost the styling for the summary list, with borders but without actions. This means the spacing looks like this on small screens:

screen shot 2018-12-20 at 11 03 13

I'll give this a go

@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-review-pr-1065 December 20, 2018 11:54 Inactive
@dashouse
Copy link
Author

dashouse commented Dec 20, 2018

Latest commit adjusts small screen spacing for actions

screen shot 2018-12-20 at 11 54 30

And increases spacing when there are no actions (with a new class govuk-summary-list--no-actions .

screen shot 2018-12-20 at 11 54 42

@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-review-pr-1065 December 21, 2018 09:57 Inactive
@dashouse
Copy link
Author

@NickColley Thanks, of course. This will just work now, just moved the margin cbee09e

@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-review-pr-1065 January 3, 2019 12:46 Inactive
@NickColley
Copy link
Contributor

Based on the results of #1096 I think we should stick with the current approach, we can improve this in the future if we want to, so this is ready for final review.

@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-review-pr-1065 January 9, 2019 10:40 Inactive
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-review-pr-1065 January 9, 2019 10:46 Inactive
Copy link
Contributor

@36degrees 36degrees left a comment

Choose a reason for hiding this comment

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

There's one minor issue with one of the examples.

Otherwise this generally looks great 👍 Top work 👏

text: Find
- href: '#'
text: View
- href: '#'
Copy link
Contributor

Choose a reason for hiding this comment

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

Minor – this last link doesn't have any text, so you get an empty link at the end of the actions.

actions:
items:
- href: '#'
text: Buy
Copy link
Contributor

Choose a reason for hiding this comment

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

😆👌

@NickColley NickColley added this to the [NEXT] milestone Jan 9, 2019
Copy link
Contributor

@aliuk2012 aliuk2012 left a comment

Choose a reason for hiding this comment

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

Amazing work @NickColley & @dashouse!!

@joelanman
Copy link
Contributor

great work everyone :)

@aliuk2012 aliuk2012 deleted the data-list-component branch January 10, 2019 15:12
@aliuk2012 aliuk2012 mentioned this pull request Jan 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

8 participants