-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix: CSS to animate popups, dialog for accessibility (fixes #600)
- Loading branch information
1 parent
fda4c9e
commit a65700b
Showing
14 changed files
with
224 additions
and
163 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import Backbone from 'backbone'; | ||
import Adapt from 'core/js/adapt'; | ||
import ShadowView from './views/ShadowView'; | ||
|
||
class Shadow extends Backbone.Controller { | ||
|
||
initialize() { | ||
this.listenTo(Adapt, { | ||
'adapt:start': this.onAdaptStart | ||
}); | ||
} | ||
|
||
onAdaptStart() { | ||
this._shadowView = new ShadowView(); | ||
this._shadowView.$el.prependTo('body'); | ||
} | ||
|
||
get isOpen() { | ||
return this._shadowView?.isOpen ?? false; | ||
} | ||
|
||
async show() { | ||
return this._shadowView?.showShadow(); | ||
} | ||
|
||
async hide() { | ||
return this._shadowView?.hideShadow(); | ||
} | ||
|
||
remove() { | ||
this._shadowView?.remove(); | ||
this._shadowView = null; | ||
} | ||
|
||
} | ||
|
||
export default new Shadow(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import Adapt from 'core/js/adapt'; | ||
import Backbone from 'backbone'; | ||
import { transitionNextFrame, transitionsEnded } from '../transitions'; | ||
|
||
class ShadowView extends Backbone.View { | ||
|
||
className() { | ||
return 'shadow js-shadow u-display-none'; | ||
} | ||
|
||
attributes() { | ||
return { | ||
id: 'shadow' | ||
}; | ||
} | ||
|
||
initialize() { | ||
this._isOpen = false; | ||
this.render(); | ||
} | ||
|
||
render() { | ||
const template = Handlebars.templates.shadow; | ||
this.$el.html(template({ _globals: Adapt.course.get('_globals') })); | ||
return this; | ||
} | ||
|
||
get isOpen() { | ||
return this._isOpen; | ||
} | ||
|
||
async showShadow() { | ||
this._isOpen = true; | ||
this.$el.addClass('anim-open-before'); | ||
await transitionNextFrame(); | ||
this.$el.removeClass('u-display-none'); | ||
await transitionNextFrame(); | ||
this.$el.addClass('anim-open-after'); | ||
await transitionsEnded(this.$el); | ||
} | ||
|
||
async hideShadow() { | ||
this._isOpen = false; | ||
this.$el.addClass('anim-close-before'); | ||
await transitionNextFrame(); | ||
this.$el.addClass('anim-close-after'); | ||
await transitionsEnded(this.$el); | ||
this.$el.addClass('u-display-none'); | ||
await transitionNextFrame(); | ||
this.$el.removeClass('anim-open-before anim-open-after anim-close-before anim-close-after'); | ||
} | ||
|
||
} | ||
|
||
export default ShadowView; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.