Browsed by
Tag: ux

Building a new Moodle Theme

Building a new Moodle Theme

With the launch of the college’s new branding and a planned Moodle upgrade our Moodle theme needed a refresh. Over the last 6 years or so I’ve built numerous WordPress themes from scratch so I took on a new challenge and looked at the Moodle Documentation and began learning how to building our own using the college’s new colours and fonts.

This was entirely new to me as I only started picking up Moodle when I joined the College in December 2019 and had to pick it up rather quickly given the pandemic.

Design Principals

There were a few things I was keeping in mind.

  • To maximise the space as much as possible for the Lecturers and Students
  • To make everything as accessible as possible.
  • Keep it as simple as possible ( K.I.S.S. )

Accessibility Guide
WCAG Accessibility Guidelines
The Public Sector Bodies (Websites and Mobile Applications) (No. 2) Accessibility Regulations 2018

Problems to overcome

There were (and still are) a few barriers to building the theme. Some of these will disappear once we are able to move to the new course layout that my colleague Steve has designed and developed. For now we need to support the legacy setup.

  • Multiple course formats have been installed into the existing VLE and need to be supported.
    I focused on the CORE functionality to start with then started working on adding in support as we worked out what course formats were still being used.
  • Multiple plugins have been installed into the existing VLE over the years and some need to be supported.
    This caused unexpected conflicts at points that took time to diagnose.
    Eventually our plan is to install a fresh Moodle with Steve’s course layout and we will go through and remove unnecessary plugins

Overview of the new design.

To break this very long post up I have separated out each component into a separate post. Some of the changes were simple changes to the SCSS files and others involved output renderer overrides. Click on each of the post embeds to find out more.

Screenshot of the new Moodle Theme.
Screenshot of the New Moodle Theme Dashboard

Navigation Panel

Role Descriptor on top Menu

You are logged in as….

Redesigning the footer…

Currently writing up

  • User Menu
  • Custom Menu to useful services for the Students.

Editor Button

Currently writing up…

Forum Post Layout

Currently writing up

Course Search Layout

Currently writing up

Book Navigation Modifications

Currently writing up

POST TO BE CONTINUED….

Useful Documentation

Creating a Theme using Boost (Moodle Documentation)
Themes Overview (Moodle Documentation)
Moodle Template Overview
Moodle Renderers
Moodle Output Renderers
Moodle Filters
Moodle Roles
Moodle Navigation API
Useful UnObvious things
How to Override a Template
How to Override a renderer

Mustache Documentation
Moodle Theme SCSS
Moodle Theme Pre and Post SCSS
Moodle HTML Writer

Moodle Data Manipulation API


Moodle Theme : Modifying the Navigation Panel

Moodle Theme : Modifying the Navigation Panel

This post is part of a series documenting the work I did while developing a new Moodle Theme for Dumfries and Galloway College’s VLE. There will be further posts to follow. Watch this space!

Modifying the navigation panel was a fairly small change from the base boost theme this theme was based on. The main changes made were :

  • Animating the menu toggle button along the top using the excellent CSS library by Jonathan Sue.
    Note : rather than include the entire library I only included the SCSS being used.
  • Modifying the side panel so when minimised you could still see and click on the icons.
  • Modifying how the scrollbar displayed

The side panel can be navigated easily by keyboard (this is part of Moodle Core so I didn’t need to add this in). It is also scrollable on small screens or when there’s a lot of content.

The main content re-adjusts as the side panel is opened and closed (see example in the second video). This is actually handled using CSS and media queries targeting the classes added by Moodle when the side panel is open or closed. I’ve added some example SCSS below.

.courses  { 
	grid-template-columns: 1fr 1fr;
	nav,
	.paging-showall {
		grid-column-start: 1;
		grid-column-end: 3;
	}
	.drawer-open-left & {
		grid-template-columns: 1fr;
		nav,
		.paging-showall {
			grid-column-end: 2;
		}
	}
}

Handling Feedback and Adding in a Scroll Indicator

Initially I set the scrollbar to be invisible. I did this because on Windows machines the scrollbar is large, chunky and takes up a fair bit of space on the side panel. It also doesn’t look very aesthetically pleasing compared to the Mac OS scrollbar. We were also keen to maximise space for the learner where we could so I felt hiding it while keeping the area scrollable as you hovered over this area was a good choice.

Despite the scrollbar being invisible it was still easy to scroll the side panel by gesture (mobile devices) or by using the mouse scroll wheel when hovered over and as mentioned above it was possible to navigate via keyboard for accessibility.

However, thanks to feedback from one of our Lecturers Margaret, it became clear that on some devices which didn’t have good trackpad / scroll support the scrolling feature wasn’t working quite so well. It took a bit of back and forth to isolate the issue as every device I tested on windows or mac worked correctly and I’m very grateful for Margaret’s patience!

After some additional research into the issue and discovering the cause could be due to the trackpad support on certain devices I felt we needed to have some kind of indicator that could be clicked and dragged to :

  • a) solve the issue Margaret had flagged
  • b) to improve on the existing accessibility by giving a visual cue.
  • c) make it more obvious that the section was scrollable

I also wanted to make sure that the scroll indicator didn’t take up too much space in the relatively small area and was consistent across devices and browsers.

For both methods (making invisible and changing the styling) I used CSS selectors that targeted the Shadow DOM.

The first code block is the original hidden scrollbar styling that uses the CSS selectors for the shadow DOM. There is some extra code to add support for old versions of IE (no longer an issue) and Firefox.

.scrollbar-hidden::-webkit-scrollbar {
	display: none;
}

/* Hide scrollbar for IE, Edge add Firefox */
.scrollbar-hidden {
	-ms-overflow-style: none;
	scrollbar-width: none; /* Firefox */
}

The second code block is the updated shadow DOM styling which just adjusts the look of the scrollbar so it is thinner but visible and matches the brand colours.

.scrollbar-thin::-webkit-scrollbar {
	width: 5px;
	height: 4px;
	cursor: pointer;
}
.scrollbar-thin::-webkit-scrollbar-thumb{
	background: $DGCOrange;
	border-radius: 0px;
}

.scrollbar-thin::-webkit-scrollbar-thumb:hover{
	background: $OrangeTint75;
	cursor: pointer;
}
.scrollbar-thin::-webkit-scrollbar-track{
	background: transparent;
	border-radius: 0px;
	box-shadow: inset 0px 0px 0px 0px #F0F0F0;
}

Further Reading on Styling Scrollbars using the Shadow DOM

There’s an excellent guide on CSS Tricks about using the shadow Dom to customise scroll bars linked below.

https://css-tricks.com/custom-scrollbars-in-webkit/

Further Improvements?

Web development is of course never done and it’s important to constantly think about how we can continue to improve the interface for users. There are a couple of things I’m thinking about in order to improve and develop this further.

  • A “hover over” to show the menu item title when it’s hovered over when collapsed. This does sort of happen anyway if you hover for long enough but I think it would be a nice feature if it was more instantaneous.
  • Checking that everything responds to the view area shrinking / growing – there may be a few areas that have been missed since Moodle is so huge and we have multiple extra course formats installed as well as hundreds of extra plugins.
  • Work out what changes are needed for Moodle 4.

I hope to add these in future iterations of the theme or in my Moodle 4 upgrade.