Drupal Planet

How to use the LocalGov Drupal KeyNav Module

Beautifully crafted digital products and experiences that matter.

Here's a short video outlining the features of the LocalGov Drupal KeyNav module.

Thanks to Big Blue Door for sponsoring the time to work on this module.

Install the module via composer require localgovdrupal/localgov_keynav.

Any issues, file them on GitHub.

 

 

Join the "Something nice ..." newsletter

The full title is "Something nice, something quirky, something else".

I send an email once a week with something nice, something quirky, and something else that I think is interesting (all with a web development theme, of course).

My Drupal Core Contributions for week-ending July 26th, 2024

Code Enigma Logo

Here's what I've been working on for my Drupal contributions this week. Thanks to Code Enigma for sponsoring the time to work on these.

This week I mostly worked on the Umami installation profile, which I am a Drupal core maintainer for. Here's what I worked on:

  1. We have a really nice module in Drupal core since 10.3 for a new navigation toolbar. It's currently experimental, so use with a little bit of caution. I created a merge request to enable this feature by default for Umami.
  2. I spent time working through some of the Umami issue queue to triage them, updating some and closing others. It's always good to keep your issue queue in order.
  3. Joel created an issue on my Content Access by Path module, whereby editors were able to edit nodes that they should not have been if they were granted path access to them. This proved trickier to track down the cause of than I expected, but we have a merge request for it now.

Thanks again to Code Enigma for sponsoring the time to work on this. This is how open source projects flourish.

Join the "Something nice ..." newsletter

The full title is "Something nice, something quirky, something else".

I send an email once a week with something nice, something quirky, and something else that I think is interesting (all with a web development theme, of course).

My LocalGov Drupal contributions for week-ending July 26th, 2024

Beautifully crafted digital products and experiences that matter.

Here's what I've been working on for my LocalGov Drupal contributions this week. Thanks to Big Blue Door for sponsoring the time to work on these.

Need LocalGov Drupal services? Give Big Blue Door a shout.

Meetings and Meet-ups

  1. Merge Tuesday. We had a merge merge for the microsites platform, to do access control in a much better manner, and allowing us to properly add/restrict content types to different microsites.

Code Contributions

This week was all about "keep the head down and get a beta release of the keynav module". So that's what I did. I had three objectives:

  1. Create a pattern so we can easily support all toolbar items
  2. Allow sites to choose their own patterns
  3. Allow individual users to switch the feature off

Create a pattern so we can easily support all toolbar items

I got this complete, though it took jumping through a few mental hoops to get there. We can now type lgdt (t for toolbar) followed by the order number in the toolbar that we want to get to. For example, if a toolbar list is like this

  1. Drupal icon
  2. Content
  3. Structure
  4. Extend
  5. etc

We can type lgdt3 to go to the Structure page.

Next, if we want to go to a sub-item of the Structure menu, and those items are in this order:

  1. Block layout
  2. Block types
  3. Content types
  4. etc
  5. We can type lgdt3.3 to get to the Content types page.

And then if we want have sub-items of Content types listed like this:

  1. Event
  2. News
  3. Service

We can type lgdt3.3.2 to get to the News content type.

And if the News has sub-items, well ... you get the idea lgdt3.3.2.3 and so on ...

Use Enter to trigger your shortcut

I had the module set up to submit as soon as you had come upon a combination that did something. However, if you wanted a shortcut like lgdacac it would fire as soon as you got to lgdac (because that would trigger the /admin/content listing). So I set up a timer to say "only fire after a half a second" so that you'd have time to type the rest of the command. 

But then I decided to not put time limits on people typing their commands - some people type slower than others. So now you can take as long as you want to type your shortcut, and it will only trigger when you click 'Enter'.

Use Escape to reset your shortcut

If you start typing lgd that triggers the shortcut mechanism into action. But if you then type something that you didn't mean to such as lgdabc you weren't able to reset and start the shortcut entry again, typing more letters would result in lgdabclgd.... I have now implemented a feature that if you click Esc (or click anywhere else on the page), it will reset the shortcut you had been entering.

Allow sites to choose their own patterns

I didn't get around to this. Hopefully next week.

Allow individual users to switch the feature off

It's an accessibility failure to not give users a mechanism to be able to switch these things off. I created a field on the user profile page for users who have the permission to use the shortcuts to now be able to turn them on or off for themselves. This means that we might allow all editors to use the shortcuts, but an individual editor might decide to turn off this feature on their own account.

I'm looking forward to seeing where we can take this module in the coming weeks. Thanks to Big Blue Door for sponsoring my time to work on it.

Join the "Something nice ..." newsletter

The full title is "Something nice, something quirky, something else".

I send an email once a week with something nice, something quirky, and something else that I think is interesting (all with a web development theme, of course).

My Drupal Core Contributions for week-ending July 19th, 2024

Code Enigma Logo

Here's what I've been working on for my Drupal contributions this week. Thanks to Code Enigma for sponsoring the time to work on these.

I focussed on the core Stable9 theme again this week. And damn was that frustrating. 

An issue I thought (hoped?) we had fixed last week where Stable9 used to override Drupal core's off_canvas library, but now has no matching CSS files. The tests were failing, but I couldn't figure out why - it was reportedly missing the off canvas files, but that was a good thing, since they don't exist. 

An hour later, after putting the off_canvas libarary name back into the $librariesToSkip variable, I got that test running again. Only to discover that a functional JavaScript test was now failing. And so I spent another hour figuring that out. Only to discover that it was a red-herring and the failing test was a blip in the CI tools. So ... now all the tests are passing and we should be able to get this committed. 

I think I need a shower after all that.

Don't shower yet, Mark, you're not finished. 

Oh really? Yeah, remember that cool merge request from 2 weeks ago to set the dates for each node in Umami to a unique date? Well, that also has a failing test. But only if you install Umami using Spanish as the default language.

My Spanish isn't very good - it's non-existant - so trying to track down the cause of that failing test was about as enjoyable as you can imagine. But ... I tracked it down, so hopefully we'll also get that merged now as well.

Thanks to Code Enigma for sponsoring my time to go through this masochism 😀

Update

  1. The stable9 issue got merged later this afternoon, and
  2. The Umami issue got set to 'Reviewed and tested by the community" this afternoon, so
  3. That's all good news, and
  4. I can now go for that cold beer!

 

Join the "Something nice ..." newsletter

The full title is "Something nice, something quirky, something else".

I send an email once a week with something nice, something quirky, and something else that I think is interesting (all with a web development theme, of course).

My LocalGov Drupal contributions for week-ending July 19th, 2024

Beautifully crafted digital products and experiences that matter.

Here's what I've been working on for my LocalGov Drupal contributions this week. Thanks to Big Blue Door for sponsoring the time to work on these.

I'm wrecked after all the work this week, but in a good way! Another really enjoyable week making LocalGov Drupal better for everyone. I'm particularly excited about the module I started working on that will allow site users to navigate their LGD backends via keyboard shortcuts. Can't wait to work on that more in the coming weeks.

Need LocalGov Drupal services? Give Big Blue Door a shout.

Meetings and Meet-ups

  1. Merge Tuesday. Docs got a good looking at in this week's Merge Tuesday. It's always good to make a documentation better. We also had a nice merge of demo content for publications, and started looking at a template for PRs so when you create one the reviewers will have a better idea of what is happening.
  2. Netcall/LGD working group: We had a good look through connecting the Netcall call center data with a Drupal website, so content designers can see what the most popular items people are calling about and target content towards this.
  3. Community Meet-up: I always enjoy this to see what else people are working on and what features people want us to work on. This week I gave a presentation on the upcoming features for Drupal 11.
  4. Tech Group drop-in: Well this week's meet-up certainly got down to details. We talked about using migrate module to pull data in to your website on a continuous basis. We also talked about creating a glossary of terms for a jargon buster. And we finished off talking about how to create events.

Code Contributions

  1. I usually spend a decent amount of time in Slack each week, helping out any one who posts an issue there, so they have a good "customer experience" from LGD and get their issues solved quickly. This week this led to me creating an issue to fix our accordions when printing. Since only 1 accordion opens at a time, you can't see all the closed ones if you print the page. Well, you can now.
  2. Given the backlog of PRs we now have since we have more people working on issues, I spent a good amount of time again this week reviewing what I could so we could get more items merged. I'm trying to spend about 2 hours per week on this task to keep the number of open PRs as low as possible.
  3. I got some more work done on the NHS base theme, specifically the breadcrumbs area, background color for the body element and the screenshot used when selecting a theme.
  4. We've had an issue open to create an admin role for LocalGov Drupal since late April. We have a PR for this to add an admin role to new LGD sites, now we have a second PR adding a module which will allow existing sites to have an admin role as well if they want it. This approach will, then, allow us to use this module to apply any updates that we might want to the admin role.
  5. After all my hard work getting a sticky header working in LocalGov Base, Maria's eagle eyes noticed that I was applying the same JS/CSS to the sticky version as I was to the scrolly version. And with minutes to go before Merge Tuesday ... we got it fixed.
  6. I created an experimental module to allow us to navigate a LGD website via keyboard shortcuts. There's a blog post and video to explain it, and the code is available on GitHub. Next up: create a mechanism for it to work with all admin menu URLs. Then ... create a settings page so councils can create their own shortcuts. This really excites me!

Join the "Something nice ..." newsletter

The full title is "Something nice, something quirky, something else".

I send an email once a week with something nice, something quirky, and something else that I think is interesting (all with a web development theme, of course).

Keyboard Navigation for a LocalGov Drupal website

Navigating a LocalGov Drupal backend via keyboard shortcuts

Wouldn't it be cool if we could get around our LocalGov Drupal websites by using keyboard shortcuts?

I had an idea for a module to allow us to navigate our LocalGov Drupal websites by keyboard shortcuts. Thanks to Big Blue Door for sponsoring my LGD-contribution time, I was able to put a proof-of-concept together yesterday evening to show off my idea.

It's quite simple. I created a new module called "LocalGov KeyNav" and put the code on GitHub on my own namespace for now. Now, when you have that module enabled, you can type "lgd" followed by a series of keys and get to different pages on the site. For example:

  • ac - goes to the content listing page
  • ap - goes to the people listing page
  • acdf - goes to the directory facets page
  • t2 - goes to the 2nd item in the toolbar menu (usually admin/content)
  • t8 - goes to the 8th item in the toolbar menu (usually admin/config)
  • nasp - goes to the "Add service page" form
  • naslp - goes to the "Add service landing page" form

We can add as many more sequences as we want.

Here's a video showing it in action.

If you think this is worth pursuing, let me know in the comments on YouTube or via the LGD Slack or any other way. Thanks.

Join the "Something nice ..." newsletter

The full title is "Something nice, something quirky, something else".

I send an email once a week with something nice, something quirky, and something else that I think is interesting (all with a web development theme, of course).

My LocalGov Drupal contributions for week-ending July 12th, 2024

Beautifully crafted digital products and experiences that matter.

Here's what I've been working on for my LocalGov Drupal contributions this week. Thanks to Big Blue Door for sponsoring the time to work on these.

Meetings and Meet-ups

  1. Merge Tuesday. As usual, lots of things got merged, then we got down to a very interesting discussion about managing external libraries in our repos, based on the PR I have for bulk adding media items to our sites. We also got the cool new "Add to calendar" feature merged to LocalGov Base, which has been asked for for a long time by content designers.
  2. Content Group. We had a really interesting content group meeting this week, going through the documentation initiative for LocalGov Drupal.

I worked on two large issues this week: adding sticky header feature for LocalGov Base theme and creating a base theme for NHS websites. Let's see how it all unfolded.

Code Contributions

  1. I started working on an issue to add a sticky header feature for LocalGov Base. We have an idea in LocalGov Drupal that says "Make the hard stuff easy". A sticky header is a really good example of this, it's not easy to figure it out because of all the bits and pieces that can get in the way - are there items above the header, below the header, etc? Do items in the header affect it? Will it break existing websites? I spend most of Monday figuring out this in a way that can work for all councils. It's not perfect yet, but it a very good start for us, and comes as part of the LocalGov Base theme settings so any subtheme of this can inherit it.
  2. We are getting a backlog of open pull requests that need to be reviewed or have been approved but not merged. I spend time reviewing lots of PRs so we could merge as many as possible at Merge Tuesday.
  3. Everyone wants to help LocalGov, but not everyone knows where to start. So I wrote a blog post to help you get started.
  4. When you use the theme generation script in localgov_base, the subtheme that is created sets itself as compatible with Drupal 8, Drupal 9, and Drupal 10. I fixed that so now our subthemes are compatible with Drupal 10 and Drupal 11.
  5. If you use the linter script we created so your theme's CSS will follow Drupal's coding standards, we ship a .nvmrc file with it which stipulates Node 16 as our approved version. However, Node 16 is no longer supported, so I now have a PR created to set Node 20 as our approved version of Node, which is the current LTS version.
  6. The BIG one: there's been a lot of talk recently about using LocalGov Drupal for NHS trusts and other NHS sites. So, I went and started work on a base theme for the NHS.

Join the "Something nice ..." newsletter

The full title is "Something nice, something quirky, something else".

I send an email once a week with something nice, something quirky, and something else that I think is interesting (all with a web development theme, of course).

My Drupal Core Contributions for week-ending July 12th, 2024

Code Enigma Logo

Here's what I've been working on for my Drupal contributions this week. Thanks to Code Enigma for sponsoring the time to work on these.

This week was all about helping out in the Stable9 issue queue. Let's see how much we got done thanks to Code Enigma's sponsorship.

  1. The MR I created last week to ensure that all content in the Umami theme was inside a landmark region was further worked on by my Umami co-maintainer Finnsky. I spent some time further working on this work to tie the rest of the template and CSS together. I think what we have now is a very good layout system that will work just as well for screenreader users.
  2. I've been tinkering around at the edges of becoming a maintainer of the stable9 theme for a while now, but haven't had much time to work seriously on it. Today I got to have a good look at an issue that has been open for a number of years, saying that the system-modules-uninstall.html.twig file has an error with the {% trans %} tag. After testing, it seems fine, so I think that issue outdated, or at least needs more info.
  3. Drupal 10 updated its library for off-canvas, which is being overridden by stable9. However, now stable9 is referencing the old CSS off-canvas files which no longer exist. There's an MR to fix this, which seems to work fine, except there's a test broken somewhere. I'm trying to track it down so we can get this issue finished off and merged.
  4. I think I've tracked down why the tests are failing for the stable9 off_canvas override. All the CSS files for that override were removed so it's not actually trying to override the core library any more. That was a bit more of a rabbit hole than I expected it to be.
  5. Another stable9 issue whereby the tabledrop handles were not correctly placed. It's been open for years as it was affecting stable theme from Drupal 8. After some digging, I think it's actually a red herring issue and is actually affecting the Seven theme rather than our stable themes, so it's not marked as outdated.

What an enjoyable week that was, and now we have the stable9 issue queue down to only 3 open issues tagged as "Active", or "Needs work", or "Needs review".

Thanks to Code Enigma for again sponsoring my time to make Drupal better for everyone.

Join the "Something nice ..." newsletter

The full title is "Something nice, something quirky, something else".

I send an email once a week with something nice, something quirky, and something else that I think is interesting (all with a web development theme, of course).

Want to contribute to LocalGov Drupal, but don't know where to start?

Beautifully crafted digital products and experiences that matter.

Contributing to LocalGov Drupal is a great way to get used to how the platform works, and, in turn, makes the platform better for everyone. Here's some thoughts on how to get started.

Thanks to Big Blue Door for sponsoring my time to work on LocalGov Drupal.

Ideas to get started

Contribute what you want

I think the first thing to think about when contributing to LocalGov Drupal - indeed to any open source project - is to contribute what you want to contribute. We are always open to see what someone wants to contribute, and it might be a great idea we haven't thought of ourselves. If it's suitable, we'll accept it or ask for some modifications to bring it into line with our standards. If it's not something we are interested in, at least you have gained that knowledge too.

As an organisation, consider being a stakeholder of an initiative

All agencies have specialties. If yours is accessibility, have a look and see what accessibility needs LocalGov Drupal has. If you speciality is performance, perhaps do an audit of hour our sites fare, and suggest improvements. If your speciality is something else, figure out where we are falling short of your high standards in this area and help us make it better.

Perhaps you'd like to become known as "the agency" that does X in LocalGov Drupal. Be that agency and take a vested interest in a feature - blogs, directories, news ... whatever. It's always handy if someone has a question for us to be able to say "go chat with [your agency name here] about that".

If you are feeling really adventurous, you could propose a whole new feature for LGD and if it's a good idea, go build it. That's how I got started, I proposed a re-write of the entire frontend of LocalGov Drupal.

Ask questions

Instead of looking to contribute something specific, how about you hop on to the Slack and just ask questions for things you need to know about LGD. Then when you get answers, use that information to add to the documentation to benefit everyone. Or create tutorials and videos to show off what you now know.

Check the roadmap

We have a roadmap of activities on the LocalGov Drupal website. Have a look at it to get an idea for where we are going in the coming months and see where you can be of help.

Come to a meeting

We have lots of meetings. Come to some, learn, ask questions. After a few of these you should have lots of ideas for ways to help us out.

  • Merge Tuesday to you know what new features have been released
  • Tech group drop-in to ask any technical questions you might have
  • Tech group governance to find out about who is maintaining what
  • Content group to learn about how council content designers are using the platform
  • Product group to see what we are working on
  • And many more

Ideas for specific skills

Developers

We have two bookmarks on the technical group Slack channel

  1. Pull requests that need to be reviewed
  2. Pull requests that need to be merged/have been reviewed

These are two great places to get started. Someone has already done the work, but we are always stuck for people to help out reviewing it before it can be merged.

Frontend Developers

Have a check on the LocalGov Base repo. That's our main frontend repo. 

Following that, have a look at the LocalGov Microsites Base repo. That's the main base theme for microsites. There's a few niggling issues there about the menu system (especially for multi-level menus).

LocalGov Claro is our base admin theme. I really like it, and there's very few issues, but I'm sure it could be better.

Backend Developers

The main bulk of our project is backend work. Check any of the repos issues and there should be something for you - Guides, Step-by-Steps, Services, Directories, etc.

Content People

Documentation can always be better. have a look at our docs site and see what's missing. For example, if you look at the Designers page on the documentation, you'll see we have a link to news wireframes that links to a private PenPot. It would be good to find out if we can get an image of the wireframes and add them to the docs site.

Hopefully those ideas will spark your imagination and I'll see you soon contributing as much as possible to this great public resource.

Join the "Something nice ..." newsletter

The full title is "Something nice, something quirky, something else".

I send an email once a week with something nice, something quirky, and something else that I think is interesting (all with a web development theme, of course).

My Drupal Core Contributions for week-ending July 5th, 2024

Code Enigma Logo

Here's what I've been working on for my Drupal contributions this week. Thanks to Code Enigma for sponsoring the time to work on these.

One of the patches I wrote last week got merged on the day I wrote it. That's the fastest I've ever seen an issue go from being reported to being fixed and merged. Let's see how this week goes ...

  1. All demo content created with the demo_umami_content module is created with the same timestamp. This is fine in general, but we have some views that sort items by their created date, which is moot since they all have the same created date and time. Catch created an issue for this, and I created a merge request to set each node as being created one day after the previous node, so our sorting will work better. We have 19 nodes created with the demo content module, so this means:
    1. Node 19 was created yesterday
    2. Node 18 was created 2 days ago
    3. Node 17 was created 3 days ago
    4. and so on
  2. Sometimes you find gems, such as an accessibility issue we have open for over 5 years noting that the Umami theme does not have all of its content inside HTML landmarks. There's two solutions for this - move all the content that is outside of the <main> element to inside it, or create a new <section> to place all that content. I created a merge request to place all the content inside the <main> element, at least to get the conversation started.
  3. I started on an issue about 2 years ago to stop using hardcoded CSS values in the Umami theme and start using CSS variables. I had it in such as way that it was ready to merge - I thought - until the issue started expanding to include SVGs as well. Now we've moved half of our Umami CSS to Single-Directory Components, so that MR doesn't work any more. I'm now starting to think about how to get it redone in our SDC-enabled world. That's going to be next week's task.

Woah, another very enjoyable Friday making Drupal core better than it was yesterday. Thanks to Code Enigma for sponsoring this time.

Join the "Something nice ..." newsletter

The full title is "Something nice, something quirky, something else".

I send an email once a week with something nice, something quirky, and something else that I think is interesting (all with a web development theme, of course).