-
Notifications
You must be signed in to change notification settings - Fork 236
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
Improvements to Check your answers page #365
Conversation
45c8b4b
to
faff98b
Compare
td { | ||
@include core-19; | ||
vertical-align: top; | ||
> * { |
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.
FYI, I did it this way to allow other markup than a description list to use the same CSS. E.g. you could use a list or some divs instead and it would still look and behave the same.
I know this can also be done by giving every container and every item a class. I suspect that might be what people will ask me to change. I personally prefer it the way it is right now but would be fine with changing it if people felt strongly about it.
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.
Would be a good idea to apply classes rather than wildcards, this way people don't have to put aggressive overrides if they want to extend this pattern.
FYI, to get some context, these were the pros and cons we found with the three final contenders: Table
Description List
List
|
Just going off that list, I’d say (especially with the non-standard markup being used for definition lists) that standard lists are the winner. |
it does seem like List is a good option - it's simple, well known markup, and doesn't seem to have any downsides |
On the other hand, it doesn't have the upsides of increased semantics that DLs have. |
the DL example on MDN does seem to be our use case: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/dl#Metadata |
# 5.1.1 - Update the alpha, beta and discovery colours to $govuk-blue to match the updated phase banner ([PR alphagov#370](alphagov/govuk_frontend_toolkit#370)) - Fix radio button show/hide behaviour when used outside a form ([PR alphagov#375](alphagov/govuk_frontend_toolkit#375)) - Fix a "Stick at top when scrolling" component bug related to scroll anchoring in Chrome 56+ ([PR alphagov#376](alphagov/govuk_frontend_toolkit#376)) - Minor travis fixes ([PR alphagov#373](alphagov/govuk_frontend_toolkit#373)) # 5.1.0 - Allow custom options when tracking events ([PR alphagov#365](alphagov/govuk_frontend_toolkit#365)) # 5.0.3 - Change HMRC and DEFRA text colours for improved contrast ([PR alphagov#368](alphagov/govuk_frontend_toolkit#368))
@philsherry, remove the |
Hi @philsherry. We're going to update this PR to better deal with your situation of really long questions. Hold this space! For your specific example, the questions could be much shorter. We recommend rewriting the information on the summary screen to be more concise. The page is replaying a summary of what the user has done, so doesn't need to duplicate the original questions. This has the added benefit of making the page easier to scan, and the visually hidden text in the change link shorter. One of your questions appears to be a child of the first, so could be connected in the summary. As an example: BeforeQuestion
£100,000 to £249,000 AterQuestion By activity: |
Hi Ed, Its not always possible to just use the activity here as a child either and added, as the user could do several activities so this wouldn't always work or lend itself to the suggestion that you have made. I see no reason why the option that @philsherry has suggested could not be used in conjunction with the one currently on the table from yourselves. Its another viable options for lots of reasons depending on the content and context of the service. Currently it feels like its either the way suggested by "the powers that be" (Mordor) and no other suggestion (The Fellowship) is taken on board. Surely there shouldn't just be one way of doing this, that would surely be to the detriment of doing what's best for the user which is all we are trying to achieve. Can these sort of patterns not sit side by side depending on their usage? |
We are not "precious" over the pattern... just looking at it as an alternative. |
faff98b
to
5453f2a
Compare
vertical-align: top; | ||
.set { | ||
position: relative; | ||
border-bottom: 1px solid $border-colour; |
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'm worried that if people try to use this pattern in pre-existing CSS it'll break since these classes are very generic.
I'd recommend namespacing the classes and making sure they're as robust as possible.
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 thought of using >
again, which would make them more robust as well. But you wouldn't like that, right?
Do we have any specific namespace that we use? On the one hand we have govuk-*
, but on the other hand that in itself might not specific enough and, confusingly, we're not using it consistently.
I gave the SASS variable a prefix of cya
(short for 'check your answers'). Would that be good? Or a combination (govuk-cya-*
)?
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.
Might be worth holding off until there's some form of consensus from the new GOV.UK Frontend work.
(But wont block this)
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.
We have four(ish) options, the choice of which is probably not super important for the prototype kit but will become more important for Elements:
Child combinator (what I had before)
.foo {
> * {
}
}
I personally find that quite resilient, especially because every child has to be styled in a certain way because the display: table
children need to be display: table-row
, etc.
(I wonder if I should even go as far and use :first-child
for the question and :last-child
for the change link.)
But I understand that people don't like this.
Simple classes (what I have now)
.foo {
.bar {
}
}
I agree with Nick that the class names are too generic.
Prefixed classes (BEM would also fit here, although the example below is not BEM)
.govuk-foo {
.govuk-foo-bar {
}
}
Probably where we're generally going? I personally don't like it but that's another story.
Simple classes with child combinator
.foo {
> .bar {
}
}
More resilient than just simple classes on their own. But not resilient enough to stop potentially wrongly global classes to have an effect.
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.
With BEM we can avoid the nesting also, keeping the CSS flat (in terms of specificity https://developer.mozilla.org/en/docs/Web/CSS/Specificity, https://csswizardry.com/2014/10/the-specificity-graph/) and ensure that this pattern will work without conflict when dropped into hostile codebases.
Thanks @philsherry for your example. When I put it into the prototype kit on Friday, it looked a little bit better. (The only thing knowingly different is that I didn't use a list in the third answer.) @edwardhorsford and me then tinkered a bit with the widths and found that we were happy enough with it when we gave the question a width of 50%: I had a comment in the CSS of my original code which suggested to override the width. But I have pushed a new version on Friday evening which now gives you the |
// please adjust, depending on length of questions and answers and number of sections | ||
$cya-first-column-width: 30% !default; | ||
// recommended for single sections: auto | ||
// recommended for longer questions: 50% |
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.
Suggest adding a comment with the recommendation for shorter questions. That way if a service goes away from the default, our recommendation is still in the comments.
Is it clear what we mean by single sections?
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'm not sure what's meant by single sections
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.
The default wouldn't change when services override it, it would still say 30%
. But I can add a comment that the default is meant for short questions.
What else could we say instead of "single section"? Maybe "single set of questions"? Not sure... Any ideas?
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.
How about this:
// ## Recommended column widths
// Single group of questions: auto
// Multiple groups of questions: 30% (mostly short questions) or 50% (mostly long questions)
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.
why should the column width change for a single group of questions?
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.
Ideally I wanted to make all columns have an automatic width so that all content is flexible and you don't need to put in any constraints. That works the same way a table would work automatically. But as soon as you have a second group of questions, "designers" don't like the questions of both groups not vertically aligning. That's why you would need to give one column a fixed width.
Not sure about the “designers” part… I’m sure the “users” don’t like the questions of both groups not vertically aligning either as its far easier to read then they do.
… On 29 Mar 2017, at 14:28, Anika Henke ***@***.***> wrote:
@selfthinker commented on this pull request.
In app/assets/sass/patterns/_check-your-answers.scss <#365 (comment)>:
> @@ -1,14 +1,75 @@
+
+// please adjust, depending on length of questions and answers and number of sections
+$cya-first-column-width: 30% !default;
+// recommended for single sections: auto
+// recommended for longer questions: 50%
Ideally I wanted to make all columns have an automatic width so that all content is flexible and you don't need to put in any constraints. That works the same way a table would work automatically. But as soon as you have a second group of questions, "designers" don't like the questions of both groups not vertically aligning. That's why you would need to give one column a fixed width.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub <#365 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AEQ1IsJ9E1DfYIdqW-mkCxfbSU6GYbmBks5rqlx0gaJpZM4MkVoa>.
|
@@ -1,14 +1,75 @@ | |||
|
|||
// please adjust, depending on length of questions and answers and number of sections | |||
$cya-first-column-width: 30% !default; |
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 just realised that using a SASS variable isn't as clever as I first thought. Because that means that you can only set it once per app!
@selfthinker Can you add screenshots of what it looks like with 30%, 50% and auto? |
f755834
to
30603b0
Compare
I have just pushed another version. There are three changes:
|
@include core-19; | ||
vertical-align: top; | ||
// please adjust, depending on length of questions and answers and number of sections | ||
$cya-first-column-width: 30% !default; |
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 don't think this is relevant any more. It would still be good to include a comment description of the widths we support in the scss file though - I expect the comment in the html is more likely to get removed at some point.
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 had a smaller comment in the CSS further down. Do you think I should change anything about it?
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.
Added a few comments on some minor things. I've already chatted to @selfthinker about these in person.
} | ||
|
||
.change-answer { | ||
text-align: right; | ||
.cya-question { | ||
font-weight: bold; |
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.
Question: do you think we should use the font-mixins to explicitly set the font size for check your answers?
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.
No, I think our font mixins are used too often, which makes things less flexible and increases the CSS file size for no good reason.
If we had a variable for bold, that would be worth using, though. I couldn't find it, did I only dream about it?
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.
</dd> | ||
<dd class="cya-change"> | ||
<a href="#"> | ||
Change <span class="visuallyhidden">name</span> |
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.
We moved to using visually-hidden
a while back. Is now a good time to update this?
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've got a personal preference for the space after change to be inside the visually hidden span. Feels more correct that way.
30603b0
to
ca2c0d4
Compare
Description lists were shown to add useful information for replaying of already-entered field data: alphagov/govuk-prototype-kit#365 Apart from that, replacing the heading for the permissions field with the legend reduces duplication of that information.
We (Tax Tribunals project, MOJ Digital) implemented the This is the quote from their report:
Their suggested fix is, of course, to remove the |
font-weight: bold; | ||
padding-right: 0; | ||
margin: em(12, 19) 4em $gutter/6 0; |
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.
Could we keep the units consistent here and use em(5,19) - rather than the $gutter variable.
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've changed it now to em(4, 19)
(not 5 because it was only 5px due to the $gutter
but should really have been 4px).
I've also rewritten the structure so that the@media
queries are closer to their mobile equivalents as you mentioned (verbally) earlier.
ca2c0d4
to
375beb1
Compare
@axemonkey, to sum up what we said in the cross-government Slack channel when you brought this up:
I will try to document our specific outcomes soon. |
375beb1
to
d90f915
Compare
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.
Personally, I'd prefer if we used classes - rather than wildcards as @NickColley mentioned, I think it makes it easier to read.
I'd also prefer it if each media query block sat inside the content it related to, so it is clear where overrides are occurring for desktop.
For example:
.cya-change {
text-align: right;
position: absolute;
top: 0;
right: 0;
@include media(desktop) {
position: static;
padding-right: 0;
}
}
This is really where I'd prefer the nesting occurs, if at all.
But these are small changes to the scss we can make later, if others also agree they are useful. I won't hold this up any longer.
Thanks @gemmaleigh! I can make the media queries more granular. I'll do that today or tomorrow. |
d90f915
to
8922f3e
Compare
@gemmaleigh, I have made the media queries more granular now. I only left the section with |
Switch markup from using a table to using a description list and improve styling to be clearer and responsive. Visual changes: * Don't use the full page width if the items are short * Remove the bold from the change link * Make the key bold * Make key and value wrap on smaller screens * The width of the first column can be controlled via modifiers `cya-questions-short` or `cya-questions-long`, if there is no modifier, 'columns' automatically adjust their widths to their content The description list uses a div around each dt/dd grouping. That is currently invalid but a) in the HTML 5.2 Working Draft [1] b) supported in all the browsers (even IE6) [1] https://www.w3.org/TR/html52/grouping-content.html#the-dl-element
* Make the text more generic * Include second section
* Use `visually-hidden` class, not `visuallyhidden` * Move space from outside to inside visually hidden content
8922f3e
to
ce8e8b1
Compare
This makes markup, styling and content improvements to the 'Check your answers' page.
Markup changes
The markup was changed from a table to a description list.
We initially tried multiple variants which all looked and behaved the same and tested all of them in various assistive technology for potential accessibility issues:
dl
)ul
orol
)We found that they all work nearly equally well and all have pros and cons. The main reason for deciding to use a description list was that it seems to be the most semantic in this case (although the others are not unsemantic). Although description lists have varying support in screen readers, the context made it still easy enough to understand and navigate.
Please note, the description list uses a div around each dt/dd grouping. That is currently invalid but it's in the HTML 5.2 Working Draft and it's supported in all the browsers (even IE6).
Visual changes
Content changes