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

Alternative header layout #1278

Merged
merged 14 commits into from
Feb 12, 2020
Merged

Conversation

maxgds
Copy link
Contributor

@maxgds maxgds commented Feb 4, 2020

What

Adds a new layout alternative to the layout header.
https://trello.com/c/vMiHP2yB/194-build-header-layout-for-search-on-left

Why

This is needed for pages in whitehall such as https://www.gov.uk/government/how-government-works

Notes: The layout change meant that the skeleton of the html needed to change. To avoid repeating blocks they are now in partials. I tried to do this with content blocks but it broke the component's examples page as each render of the content block appended itself to the previous ones before displaying.

This is being pushed back into a non-master branch so that individual chunks of work can be reviewed and monitored on Trello rather than pushing to one huge PR.

Screenshot

Screenshot 2020-02-04 at 15 08 10

@bevanloon bevanloon temporarily deployed to govuk-publis-alternativ-hvqbzz February 4, 2020 12:13 Inactive
@bevanloon bevanloon temporarily deployed to govuk-publis-alternativ-hvqbzz February 4, 2020 12:32 Inactive
@bevanloon bevanloon temporarily deployed to govuk-publis-alternativ-hvqbzz February 4, 2020 12:34 Inactive
@maxgds maxgds marked this pull request as ready for review February 4, 2020 15:13
@kr8n3r
Copy link
Contributor

kr8n3r commented Feb 4, 2020

is it known that the nav menu is not visible on mobile?

@maxgds
Copy link
Contributor Author

maxgds commented Feb 5, 2020

is it known that the nav menu is not visible on mobile?

No, it wasn't... it was working previously I must have broken something. Looking into it.

@maxgds
Copy link
Contributor Author

maxgds commented Feb 5, 2020

is it known that the nav menu is not visible on mobile?

Fixed now, I'd accidentally optimised away the div that set the relative position.

@bevanloon bevanloon temporarily deployed to govuk-publis-alternativ-hvqbzz February 5, 2020 13:59 Inactive
@maxgds maxgds changed the title Alternative header layout [WIP] [broken rebase - fixing] Alternative header layout Feb 5, 2020
@bevanloon bevanloon temporarily deployed to govuk-publis-alternativ-hvqbzz February 5, 2020 14:38 Inactive
@bevanloon bevanloon temporarily deployed to govuk-publis-alternativ-hvqbzz February 5, 2020 14:44 Inactive
@bevanloon bevanloon temporarily deployed to govuk-publis-alternativ-hvqbzz February 5, 2020 14:49 Inactive
@maxgds maxgds changed the title [WIP] [broken rebase - fixing] Alternative header layout Alternative header layout Feb 5, 2020
@bevanloon bevanloon temporarily deployed to govuk-publis-alternativ-hvqbzz February 5, 2020 15:40 Inactive
Copy link
Contributor

@andysellick andysellick left a comment

Choose a reason for hiding this comment

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

A few initial visual discrepancies (I haven't dived into the code yet). The live header has the mobile menu on the right, this has it on the left:

Screenshot 2020-02-06 at 11 39 51

Screenshot 2020-02-06 at 11 40 14

Between 768px and somewhere around 640px the mobile menu's icon collapses beneath it:

Screenshot 2020-02-06 at 11 42 54

@maxgds
Copy link
Contributor Author

maxgds commented Feb 6, 2020

A few initial visual discrepancies (I haven't dived into the code yet).

The layout at mobile is different anyway - the search bar is full width deliberately rather than half width to some arbitrary point where it gets hidden on live. Likewise the menu items don't try to cram into 2 columns. I thought it made more sense for the menu button to appear on the left than on the right if we're not putting the search over there. If you think it should be on the right, why?

I'll look into the separated icon, though.

@andysellick
Copy link
Contributor

I'm not sure which side it should be on, I was just pointing out the difference.

Another slightly odd behaviour - if you expand the menu on mobile then switch to desktop the whole of the menu is pushed down slightly. Obviously this is a niche use case and doesn't represent a barrier to anything, it's just a little odd.

header

Copy link
Contributor

@andysellick andysellick left a comment

Choose a reason for hiding this comment

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

Seems good, I have a few comments, mostly me being nitpicky, but a couple of things that might need looking at.

}

}

Copy link
Contributor

Choose a reason for hiding this comment

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

Nitpick: I'd remove this blank line and line 83.

<div class="govuk-header__logo gem-c-header__logo">
<a href="/" class="govuk-header__link govuk-header__link--homepage">
<span class="govuk-header__logotype">
<svg role="presentation" focusable="false" class="govuk-header__logotype-crown" xmlns="http://www.w3.org/2000/svg" viewbox="0 0 132 97" height="32" width="36">
Copy link
Contributor

@kr8n3r kr8n3r Feb 6, 2020

Choose a reason for hiding this comment

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

role=presentation is being replaced with aria-hidden=true
see alphagov/govuk-frontend#1724

@bevanloon bevanloon temporarily deployed to govuk-publis-alternativ-hvqbzz February 10, 2020 10:29 Inactive
@bevanloon bevanloon temporarily deployed to govuk-publis-alternativ-hvqbzz February 12, 2020 08:35 Inactive
    This adds a new layout alternative that allows for search on the
    left of the header and navigation items on the right to support
    some layouts seen in whitehall pages.

    It also corrects a stray div that was breaking the with-nav option
    without a searchbox.
- Concatenates the appropriate header classes before implementing
them more simply
- Reduces repitition in code where the search_left layout branches
from the standard
This spacing that was added during development isn't doing anything
but introduced a minor bug when resizing the browser with the nav
open, so this removes it.
- Removes spurious space
- Adds a description of where this variant of header is used
@bevanloon bevanloon temporarily deployed to govuk-publis-alternativ-hvqbzz February 12, 2020 09:49 Inactive
}


Copy link
Contributor

Choose a reason for hiding this comment

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

Additional new lines here

@vanitabarrett
Copy link
Contributor

Is this placement of the menu link here correct? Could the spacing below the Menu link match the spacing above, as it looks quite close to the blue border?

Screenshot 2020-02-12 at 10 07 44

@vanitabarrett
Copy link
Contributor

Not sure if this is a problem which existed before, but it looks like a search bar on it's own needs some bottom spacing on smaller devices so it doesn't touch the blue bar

Screenshot 2020-02-12 at 10 08 15

@bevanloon bevanloon temporarily deployed to govuk-publis-alternativ-hvqbzz February 12, 2020 11:29 Inactive
@injms
Copy link
Contributor

injms commented Feb 12, 2020

There are a couple of false positives with the automated accessibility tests caused by the component being repeated on the example page - it's not a problem with the component, as this is (hopefully) something that wouldn't happen in the real world use.

We can turn off the checks by adding duplicate-id-aria and form-field-multiple-labels to the accessibility_excluded_rules in the layout header's YAML file.

An alternative fix for the form-field-multilple-labels problem is to make the id of the search component unique by appending #{SecureRandom.hex(4)} to the id - which is what's done on the accordion component.

@bevanloon bevanloon temporarily deployed to govuk-publis-alternativ-hvqbzz February 12, 2020 13:20 Inactive
@maxgds
Copy link
Contributor Author

maxgds commented Feb 12, 2020

Is this placement of the menu link here correct? Could the spacing below the Menu link match the spacing above, as it looks quite close to the blue border?

Fixed the spacing issues and the stray new lines introduce/overlooked previously.

@maxgds
Copy link
Contributor Author

maxgds commented Feb 12, 2020

There are a couple of false positives with the automated accessibility tests caused by the same components being repeated on the example page

I've ignored those checks. The accordion example is different - you could potentially have multiple accordions on a single page, but you shouldn't have multiple headers at any time, so it needs the randomising approach whereas we don't here.

@maxgds maxgds merged commit 73fe8df into rebased-add-layout Feb 12, 2020
@maxgds maxgds deleted the alternative-header-layout branch February 12, 2020 14:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants