-
Notifications
You must be signed in to change notification settings - Fork 327
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
Don't output an empty ul if 0 items provided #1259
Conversation
Thanks for this Ed. Looks good, but we'll need to write some tests for it before we merge. |
Hi @timpaul I've added some tests for @edwardhorsford as one of "Check answers" pages has a row without an actions column and this will affect us too—might as well help out! This includes a few other changes as well: 1. Allows custom classes on entire rows 2. Fixes the 1px row height change when borders are removed Before border: 0; After border-bottom-color: transparent; 3. Fixes the text alignment when the actions column isn't added |
This'll affect anyone using custom colours in their browser – they'll see a border when others don't. What's the impact of the 1px smaller row height? |
@36degrees Impact was cosmetic. I noticed the jump in height with/without borders. Hypothetically, two summary lists in left and right columns (one with borders, one without) won't be aligned. They'll be out by 1px for each row. I can roll this back or use an Thanks |
As far as I'm aware, there's no way to stop borders from becoming opaque when colours are overridden, even using This screenshot illustrates the problem: I think in this case the best thing to do is roll back that change until we can find a solution that works for everyone, and we can get the rest of these changes merged. Ta! |
{# Determine if we need 2 or 3 columns #} | ||
{% set hasActions = false %} | ||
{% for row in params.rows %} | ||
{% set hasActions = row.actions.items if row.actions.items else hasActions %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As this is a boolean, should we set it to true if row.actions.items
, rather than the contents of row.actions.items
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, sorted
<dd class="govuk-summary-list__actions {%- if row.actions.classes %} {{ row.actions.classes }}{% endif %}"> | ||
{% if row.actions.items.length == 1 %} | ||
{{ _actionLink(row.actions.items[0]) | indent(12) | trim }} | ||
{% else %} | ||
{% elseif row.actions.items.length > 1 %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What else could it be, if row.actions.items.length
is truthy and it's not 1
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right, this got refactored slightly higher up so can go now.
Was part of the first commit: f0df010
@@ -6,20 +6,27 @@ | |||
{% endif -%} | |||
</a> | |||
{% endmacro -%} | |||
|
|||
{# Determine if we need 2 or 3 columns #} | |||
{% set hasActions = false %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if this could be clearer, perhaps something like
{% set hasActions = false %} | |
{% set anyRowHasActions = false %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep I'm happy with this
|
||
expect($action.length).toEqual(0) | ||
}) | ||
it('adds dummy action columns when only some rows have actions', async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👌
@@ -80,6 +80,12 @@ | |||
} | |||
} | |||
|
|||
.govuk-summary-list__value:last-child { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could do with a comment I think
@36degrees Regarding the borders, usefully each cell has 10px bottom padding. So with borders turned off, could this be the fix? i.e. Add 1px back on: .govuk-summary-list__key,
.govuk-summary-list__value,
.govuk-summary-list__actions {
padding-bottom: govuk-spacing(2) + 1px;
border: 0;
} |
Also fixes the 1px row height jump when borders are removed
Makes sense to me 👍 |
@36degrees Review comments all addressed. Thanks again. On mobile "no-border" has margin collapsing between the rows, so I've not addressed the height jump here as I imagine that's intentional. |
This is looking good I think, thanks again. It just needs documenting in the changelog and then I can approve it. |
@36degrees Thanks. Changelog added, split into both fixes/features. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👏
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @edwardhorsford & @colinrotherham 👏
- Add new secondary and warning button variants ([PR #1207](alphagov/govuk-frontend#1207)) - Add new govuk-shade and govuk-tint functions for creating shades and tints of colours. ([PR #1207](alphagov/govuk-frontend#1207)) - Add support for custom row classes on the summary list component (including support for some rows without action links) ([PR #1259](alphagov/govuk-frontend#1259)) - Ensure fieldset never exceeds max-width This fix ensures that both WebKit/Blink and Firefox are prevented from expanding their fieldset widths to the content's minimum size. This was preventing `max-width: 100%` from being applied to select menus inside a fieldset. See discussion in ["Reset your fieldset"](https://thatemil.com/blog/2015/01/03/reset-your-fieldset/) and raised by [issue #1264](alphagov/govuk-frontend#1264) ([PR #1269](alphagov/govuk-frontend#1269)) - Add various fixes to the summary list component: 1. Fixes the 1px row height change when borders are removed Padding is now adjusted by 1px instead 2. Fixes the text alignment when the actions column isn't added So the key column always stays at 30% width ([PR #1259](alphagov/govuk-frontend#1259)) https://github.com/alphagov/govuk-frontend/releases/tag/v2.11.0
I need to provide an empty action option so that I don't get weird gaps like this:
You can fix this by providing an empty action.items - but right now this results in an empty ul. This pr doesn't spit out the ul if there's 0 items.
NB: untested!