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

Simplify code related to the admin menu #4005

Merged
merged 5 commits into from
Sep 21, 2020
Merged

Simplify code related to the admin menu #4005

merged 5 commits into from
Sep 21, 2020

Conversation

javierm
Copy link
Member

@javierm javierm commented May 8, 2020

References

Objectives

  • Remove the need to render the admin menu twice, which made the generated HTML invalid
  • Simplify code
  • Make the menu toggle on small screens work without JavaScript
  • Remove a no longer used layout

It isn't used since commit e5f9cf6.
@javierm javierm force-pushed the off_canvas branch 7 times, most recently from a99d14b to b3fd14b Compare September 21, 2020 11:22
Copy link
Member

@Senen Senen left a comment

Choose a reason for hiding this comment

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

Great simplification! 👏

I left you a very simple change suggestion! It’s not a big deal

app/assets/stylesheets/mixins.scss Outdated Show resolved Hide resolved
Consul Democracy automation moved this from Reviewing to Doing Sep 21, 2020
decabeza and others added 4 commits September 21, 2020 15:14
While Foundations's off-canvas menu allows us to forget about writing
CSS, it also leads to complicated HTML.

Ideally Foundation would provide an easy way to simplify what we're
doing, but I haven't found anything in the documentation.

We could simplify the HTML a bit more if we used a CSS grid layout
instead of a flex one, but old browsers have better support for the
latter.

Note we're using `breakpoint(medium)` so we can group the CSS for small
screens and follow SCSS-Lint rules at the same time.

Also note behavior of the main area when the menu appears on small
screens is slightly different: it doesn't move the main content to the
right. I've done it this way so we don't have any overflow issues,
unlike the previous version.

There's a small issue using a label and a checkbox to enable/disable the
menu: sighted keyboard users with a small screen might not be able to
enable the menu. So we're adding the `:focus-within` pseudoclass so the
menu can be normally navigated using the keyboard. Even if old browsers
don't support this pseudoclass, we believe the probability of a sighted
user using a small screen, navigating with the keyboard and using an old
browser is really low, particularly in the admin area.

We're also adding the `aria-hidden` attribute on the label, since the
menu is never hidden for screen readers and so having a control to show
it could be confusing. Since the label is not focusable, we're complying
with the fourth ARIA rule:

> Do not use role="presentation" or aria-hidden="true" on a focusable
> element .
>
> Using either of these on a focusable element will result in some users
> focusing on 'nothing'.
The <main> tag was including the navigation, and now we use the same
flex layout, making it more accessible for mobile phone users.

I'm not sure the <main> tag should actually include the account info and
the flash message. I'm keeping it like this in order to keep the layout
the way it was.
The `side_menu` helper method isn't necessary since commit 13b3d9c.
Consul Democracy automation moved this from Reviewing to Testing Sep 21, 2020
@javierm javierm merged commit 93cf9e2 into master Sep 21, 2020
Consul Democracy automation moved this from Testing to Release 1.2.0 Sep 21, 2020
@javierm javierm deleted the off_canvas branch September 21, 2020 13:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants