Many times the action menu item triggers modals to show more information
to the user. In most cases this is enough, however, a modal will close
the menu and the user is not able to see the modal content in the page
context. To solve this now menus can define subpanels that are displayed
next the the menu item when the item is focused or hover. This will be
used to group options like the group mode in activities or to replace
the adhoc solution implemented to select language in the user menu.
Add a new global module to get information from the page. Some methods
are just local functions moved to as a global library. For example, the
drawers isSmall or isLarge to detect the page width. The other funcionts
added are to detect focusable elements and they are needed to loop on
elements, especially when accessibility keyboard navigation is implemented.
When an AMD dialogue is opened from a YUI dialogue, the YUI dialogue is
not actually removed from the DOM, but was counted in z-index
calculation.
We need to stop including it otherwise nested AMD => YUI => AMD
dialogues get broken.
The selected value of the dropdown was being cleared when the dropdown
was opened, this was causing an error when submitting the form if the
field was required. The main cause was that we were emptying the
select before loading new values, this solution was created because
of an issue where we could not deselect values if the list was
reloaded. To fix this problem, I added an empty option as the first
element of the select only when deselecting a certain item.
This is a follow up of MDL-75908 because a Behat tests with the Chrome
driver was failing and it could be traced back to the changes of
MDL-750908. There was no issue with the Firefox driver and
apparently no issue when using the Chrome browser under normal
circumstances.
- Create a new 'showmore' template that receives both collapsed and expanded content.
Initially only the collapsed content will be displayed with a "Show more" button. When it is expanded,
only the expanded content will be displayed with "Show less" button.
- Add 'showmore' component to component library
Ensure we don't create nested <script> tags when rendering templates,
which triggers console errors since 1ef815cd.
Co-authored-by: Andrew Nicols <andrew@nicols.co.uk>
Rather than storing strings by an ID, we instead store them by the
string placeholder value.
This means that:
- we can fetch them by placeholder (e.g. `[[_s144]]`) rather than by
index
- we can lazily clean them on fetch
- we only clean them once, rather than on every insertion.
The old handling was extremely convoluted, and likely inefficient.
It's much clearer to use a regex with named groups and loop through in a
standard way.
This commit breaks apart the responsibilities of the core/templates
module to separate out the different constituent parts. Broadly speaking
these are:
- core/local/templates/loader - responsible for fetching, and caching,
of templates
- core/local/templates/renderer - A Moodle wrapper around the Mustache
engine