Published: July 25, 2024
My LocalGov Drupal contributions for week-ending July 26th, 2024
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.
![Beautifully crafted digital products and experiences that matter.](/static/ff4d2af8bef75e5f19298c267b09741a/c2d17/big-blue-door-with-blurb.png)
Need LocalGov Drupal services? Give Big Blue Door a shout.
Meetings and Meet-ups
- 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:
- Create a pattern so we can easily support all toolbar items
- Allow sites to choose their own patterns
- 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
- Drupal icon
- Content
- Structure
- Extend
- 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:
- Block layout
- Block types
- Content types
- etc
- 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:
- Event
- News
- 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.