-
Notifications
You must be signed in to change notification settings - Fork 17
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
New: Added Navigation Button API #339
Conversation
Created adaptlearning/adapt-contrib-pageLevelProgress#174 for Page Level Progress style changes. |
@oliverfoster I've added a class called Question: Are two text label position options enough? Default would be label on the right, and the new option would be label under the icon. Would it be better to have something like |
I'm sure there will be an rtl requirement at minimum. @guywillis positioning controls at a course level? |
@oliverfoster Ok, I can create classes for I think course-level positioning is probably fine? |
I've implemented this in the Less for now. If we need to give devs more control (which might be overkill), we could add another Property name:
This would add a class to
|
I'd like to get @guywillis input on this bit as it was his biggest concern, along with a review of the styling. |
I think, in lieu of an option in the JSON, these classes should be sufficient for custom styling. What should be the default in either case? |
I think 'medium' is a good default. That's what we usually use in projects. |
Positioning and breakpoint settings have been added at the top level. course.json
Schemas will need to be updated. |
Schemas have been added for the new options. |
@guywillis I've modified the styles a bit and added a new option called "any" that will show the labels at any size. Labels can still be hidden completely at the global level with |
Just for my own sanity, these are all of the Navigation Button API-related PRs: https://github.com/adaptlearning/adapt-contrib-core/pull/339 - ✅ Merged |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Couple of comments to adjust defaults but otherwise I'm happy - really nice work
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
One more approval and we're ready to merge. |
🎉 This PR is included in version 6.34.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
fixes #338
New
NavigationButtonModel
To hold the properties for each buttonNavigationButtonView
For extensions to make their own buttons and for legacy injected button managementNavigationModel
To hold the navigation configurationGeneral API layout:
To make a home button:
Each button has the potential for custom
_id
,_order
,_event
,_showLabel
,_classes
,_iconClasses
,_role
,ariaLabel
andtext
, with global settings for_showLabel
,_navigationAlignment
and_isBottomOnTouchDevices
._event
has some default behaviour at"backButton"
,"homeButton"
,"parentButton"
,"skipNavigation"
and"returnToStart"
.Example:
Added visua11y and the above home button to the vanilla course
Backward compatibility
Older buttons should have an
aria-label
attribute or an.aria-label
element in order for a text label to be automatically generated. A<span class="label" aria-hidden="true">{{ariaLabel}}</span>
will be appended automatically to any existing button, if it doesn't exist, and will otherwise be automatically updated from the value of thearia-label
attribute or.aria-label
element. This is as modeltext
defaults to{{ariaLabel}}
. On older buttons"ariaLabel"
,"_role"
and"_classes"
have no effect when changed from the model as they should be supplied by the injected buttons themselves."text"
,"_order"
,"_showLabel"
,"_id"
and"_event"
should work as expected on older injected buttons.Requires
https://github.com/adaptlearning/adapt-contrib-pageLevelProgress/pull/174
https://github.com/adaptlearning/adapt-contrib-trickle/pull/188
https://github.com/adaptlearning/adapt-contrib-vanilla/pull/415 - ✅ Merged
Testing
In the console it is possible to use:
require('core/js/navigation').model.set('_showLabel', true);
require('core/js/navigation').getButton('back').set('_order', 400);
require('core/js/navigation').getButton('back').set('text', 'New Label');